There is an array A:
let arrA = [{
name: 'twitter',
active: true
}, {
name: 'medium',
active: false
},
{
name: 'platinum',
active: false
}
];
And array B:
let arrB = [{
name: 'twitter',
active: false
}, {
name: 'medium',
active: false
}
];
How can I end up with an array that looks like this:
let newArr = [{
name: 'twitter',
active: true
}, {
name: 'medium',
active: false
},
{
name: 'platinum',
active: false
}
];
I need that active
property of objects in newArr
is equal to an or
between active
property of objects of arrA
and arrB
where the name
is the same.
arrA
and arrB
can have of different length