So, this is what I think is happening.
As you mentioned earlier, the global value is the same as the object window.
So when you do
global[{a}] = 7;
He looks like global["[object Object]"] = 7
Then you will get the answer :: global[{}]how 7.
Now for this
b[{a}]=7
b[{a}] // returns undefined
You have not declared bas an object why you get the answer as undefined.
If you do the following, the result will be the same:
b = {};
b[{a}]=7;
b[{a}] // returns 7
source
share