I have an object obj1 with another object inside obj2.
obj2 is structured in the same way as obj1 so there will be another object inside it.
Let's say that I have 20 of these and I'm trying to get inside each one of them to get some data.
Is there a way to create a loop that goes inside an obj as soon as it sees it?
I tried doing this but with no luck.
var location;
for (var [key, value] of Object.entries(object)) {
var type = typeof value;
var array = Array.isArray(value);
if (typeof value === "object" && array === false && value) {
location = key;
for (var [a, b] of Object.entries(object[location])) {
/*this is where I'm stuck, the location variable doesn't update with
the 'path' of every object*/
}
}
}
ullilist, so I didn't know how to get in all the objects and how to put them in a list giving them some sort of indentation.js <ul> <li>obj1</li> <ul> <li>obj2</li> <ul> <li>obj3</li> </ul> </ul> </ul>;I did the first part and now I don't know how to indent the list :c