Sample Code:
const a = {val: 1};
const b = {val: 2};
const list = [a, b];
console.info(list.includes(a)); // true
console.info(list.includes({val: 1})); // false
Questions:
- Why does the second statement evaluate as false?
- How can I properly use this method to search for a specific object in an array of objects?