We start with an array A and an array B:
let arrA = [{
name: 'twitter',
active: true
}, {
name: 'medium',
active: false
},
{
name: 'platinum',
active: false
}
];
Array B looks like this:
let arrB = [{
name: 'twitter',
active: false
}, {
name: 'medium',
active: false
}
];
The goal is to create a new array, newArr, where the 'active' property is determined by performing an 'or' operation between the corresponding 'active' properties in arrA and arrB for matching 'name' values. Here is how newArr should look:
let newArr = [{
name: 'twitter',
active: true
}, {
name: 'medium',
active: false
},
{
name: 'platinum',
active: false
}
];
It is important to note that arrA and arrB may have different lengths.