i\'m trying to use includes to see if an object is inside the array like so:
arr=[{name:\'Dan\',id:2}]
and I want to check like so:
<
Not like that. Use some instead:
some
arr.some(obj => obj.id === 2)
Which checks if there is an object with id equals to 2.
id
2
If you are checking for both id and name then:
name
arr.some(obj => obj.id === 2 && obj.name === "Dan")