Skip to content
Advertisement

Javascript – traversing through object and updating property

I’m hoping someone can point me in the right direction.

I have a JavaScript object like the following …

JavaScript

My goal is to iterate through each category/subcategory and set the value of ‘isExpandable’ depending on my logic. Can some advise how I can iterate through through each subcategory of the object, baring in mind that a subcategory and also have a subcategory and so on?

Here is my current attempt …

JavaScript

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement