I have two arrays.
let arr1 = [{id: 1, favorite: false}, {id: 2, favorite: false}, {id: 3, favorite: false}];
let arr2 = [1, 3];
If the id exists in arr2, I want to change the favorite to true (of that particular object)
For example. in the above case, the final arr1 would look like
[{id: 1, favorite: true}, {id: 2, favorite: false}, {id: 3, favorite: true}];