Below is the code snippet -
var a = {};
b = {
key: "b"
};
c = {
key: "c"
};
a[b] = 123; // Here I am confused how object is used a key
a[c] = 456;
console.log(a[b]); // output is 456
console.log(a[c]); // output is 456
Both a[b] and a[c] is printing 456. How java script is replacing b in a[b] and c in a[c].