[Solved] get all children names from object

You could write a simple recursive function that will traverse the contents of your tree: var familyTree = { name: ‘Alex’, children: [ { name: ‘Ricky’, children: [ ] }, { name: ‘John’, children: [ { name: ‘Tom’, children: [ ] } ] } ] }; var traverse = function(tree) { console.log(tree.name); for (var i … Read more