I have a situation where I am working with two arrays of objects.
arr1 = [{ name: "John" }, { name: "Frank" }];
arr2 = [
{ name: "John", age: 35 },
{ name: "Frank", age: 22 },
{ name: "Kate", age: 23 },
{ name: "Donald", age: 18 },
];
My task is to compare these arrays. If the key/value pair name matches between the two arrays, I need to add the key/value pair selected: true to the object in the second array.