I'm struggling of coping with an issue here. lets suppose I have an array of objects like this:
[
{name:Alex, products: [{type: 1, code: 1213}, {type: 2, code: 2312}]},
{name:Alex, products: [{type: 1, code: 1213}, {type: 2, code: 2312}]}
]
I would like somehow to reconstruct my object to be something like this:
[
{name:Alex, products: [{name:Alex, type: 1, code: 1213}, {name:Alex, type: 2, code: 2312}]},
{name:Alex, products: [{{name:Alex, type: 1, code: 1213}, {{name:Alex, type: 2, code: 2312}]}
]
so each nested array contains the name. Is that possible in javascript?
Is it possible in javascript?Yes.