Guys what is the best approach to modified array of object with value from object. E.g: lets say that we have array and object like this:
let arr = [
{
parameter: 'aaa',
isSomething: false
},
{
parameter: 'bbb',
isSomething: false
},
{
parameter: 'ccc',
isSomething: false
}
];
let obj = {aaa: false, bbb: true, ccc: true}
and output that I want to achieve is:
let arr = [
{
parameter: 'aaa',
isSomething: false
},
{
parameter: 'bbb',
isSomething: true
},
{
parameter: 'ccc',
isSomething: true
}
];
Could you help me with this one? I would be grateful. Thanks
entriesofobj- I don't understand what you need the first array forarr.forEach(item => item.isSomething = obj[item.parameter])should work