Can somebody explain this weird behavior of javascript on comparing the existence of an object in an array

Equality checks work different for objects than for strings or numbers:
console.log('hello' === 'hello');
console.log(2 === 2);
console.log({x:2} === {x:2});
includes work the same way as the equality operator" to which, indeed, the answer "the equality works like so" is a rewording.
includeschecks equality, and objects are only equal if they point to the same exact object in memory. each{n:1}in your sample is a different literal creating a different object, if you stored them you could modify them independently of each other