I have a single id and I need to check if it is in an array of objects. Example,
id = 2;
const arr = [{id: 1, name: 'James'}, {id: 2, name: 'Peter'}, {id: 3, name: 'Mike'}]
is there a javascript function that does this? I cant find one online the includes() method only compares if the object is in the array not if there is a property in an object exists