There's also this specification: http://ecma-international.org/ecma-262/5.1/#sec-11.9.6, though, I don't really understand how it applies to two objects. The last statement is the key I think:
Return true if x and y refer to the same object. Otherwise, return false.
var kittenA = new Kitten("kitty A");
var kittenB = new Kitten("kitty B");
kittenA === kittenB
kittenB are both of type
object so case 7 applies:
- Return true if x and y refer to the same object. Otherwise, return false.
How does the engine know they are two references to the same object? How a reference is implemented exactly will vary per engine. It might just be a number pointing to a memory location or an index in a list (of all objects).