In ECMA Specs we read that Array.prototype.includes
uses SameValueZero algorithm when comparing if an array includes given element.
This algorithm, when the element is an Object, it uses SameValueNonNumeric algorithm which basically checks if types of compared elements are matching and finally, in the last point of the algorithm it checks:
If x and y are the same Object value, return true. Otherwise, return false.
My question :
How does SameValueNonNumeric
algorithm performs the object comparison step? How does it establish that "x and y are the same Object value"? I couldn't find this in specs.
From this and this question it seems that object comparison is not so straightforward in JS.