To use Array.includes() to find object in array with JavaScript, we use the some
method.
For instance, we write
const arr = [{ a: "b" }];
console.log(arr.some((item) => item.a === "b"));
to call arr.some
with a callback that checks if item
in arr
has property a
equal to 'b'
.
If any object in arr
has property a
equal to 'b'
then it returns true
.