The includes() function usually works pretty well, but with this specific case it always returns false and I have no clue why. I spent a ton of time making sure it wasn't just a typo, and I'm pretty sure it isn't.
I want my code to return true if the value given is in the array. But what it actually does is it returns false no matter what.
Here is the code:
let array = [
{
x: 10,
y: 500,
width: 100,
height: 50
},
{
x: 100,
y: 550,
width: 150,
height: 20
}
];
if (
array.includes({
x: 10,
y: 500,
width: 100,
height: 50
})
) {
console.log(true);
} else {
console.log(false);
}