I have a set of objects with unique identifiers, and there's also an array containing specific identifier values. I want to mark the objects that have an id matching any value in the array by adding a new property called found and setting it to true. My initial thought is to utilize the findIndex function for this operation.
const arrayOfObjects = [ { id: '123' }, { id: '456' }, { id: '789' } ]
const arrayOfIds = ['456']
Desired Result
const arrayOfObjects = [ { id: '123' }, { id: '456', found: true }, { id: '789' } ]