Presented here is a data structure:
tree = [
{
"name": "Men Section",
"categories": [
{
"name": "Clothings",
"Subcategories": [
{
"name": "Jackets",
"products": [
{
"name": "jacket 01",
"price": 100
},
{
"name": "jacket 02",
"price": 140
},
// ..and so on
]
]
},
// ..and so on
]
} // ..and so on
]
In javascript (ES5 or ES6), how can one add a new property isSelected: false
to the products item object, resulting in:
{
"name": "jacket 01",
"price": 100,
"isSelected": false
}
?