In a scenario where there are two different arrays
let first = [
{ name: 'abc', num: 123, isPresent: true },
{ name: 'xyz', num: 456, isPresent: false }]
let second = []
What would be the best way to loop through the first
array and extract only the name and isPresent values to create a new array like this?
second = [{ name: 'abc', isPresent: true }, {name: 'xyz', isPresent: false }]