Is there any best option that i could use to dig, into the deep of objects, beside make some static code like this?
for(let u in menu)
for(let v in menu.list[u])
for(let w in menu.list[u].list[v])
for(let x in menu.list[u].list[v].list[w])
for(let y in menu.list[u].list[v].list[w].list[x])
for(let z in menu.list[u].list[v].list[w].lisit[x].list[y])
console.log(menu.list[u].list[v].list[w].lisit[x].list[y][z])
i couldn find the correct algorithm for this, the object is a bit random, so its probably will be a waste of if the object only have two or even on list element.
the object look like this
list: {
somethingA: {
list: {
somethingAA: {
list: {}
},
somethingAB: {
list: {
somethingABA: {}
somethingABB: {
list: {
somethingABBA: {}
}
}
}
}
}
},
somethingB: {
list: {
somethingBA: {
list: {}
},
somethingBB: {
list: {}
}
}
}
}
i could put break
, if the last list element didnt has list
element, but how if the list has child list, more than the static loop i made? which i need to be visible.
thanks