let obja = {a: 'a'}
let objb = {b: 'b'}
let objc = objb;
// and now see:
objb === obja; // false
obja === objc; // false
// but...
objb === objc; // true
and why the last one is true? well, the two variables point to the same object, as with objc = objb, the two variables point to the same place in the memory.
Right, this is confusing to the uninitiated, but when you compare reference types (objects, arrays, functions, etc…) you are not comparing the value, but the reference, or the memory address where the values are stored.
So, in ieahleen’s last example, you are seeing if they point to the same place in memory, which they do. For the expression:
{} === {}; // false
JS is creating two brand new empty objects with different references. The fact that they contain the same (lack of) data is irrelevant - all JS cares about (for this simple comparison) is if they point to the same location in memory. But we can’t interpret that to mean that two object references can never be equal. For example: