What happens in this code?
var a = {a:1};
var b = {b:2};
var c = {};
c[a] = 1;
c[b] === 1
c[b] = 2;
c[a] === 2
In particular, why using search bin creturns the value that was stored in the property a?
What does it mean to use an object as a key for a property in JavaScript?
I tested this in Chrome / Node and in Firefox.
source
share