When I run the following code:
fake_key = new Set([{v: 1, w: 2}])
fake_memo = {};
fake_memo[fake_key] = 2;
fake_key = new Set([{v: 5, w: 5}])
fake_memo[fake_key] = 5;
And then print or log fake_memo, I expect to see:
{ '[object Set]': 2, '[object Set]': 5 }
Instead I get:
{ '[object Set]': 5 }
As if the first object I inserted into the object map got clobbered by the second.
Why does this occur? How do I recover the behavior I want (both keys being inserted into the map)?
'[object Set]'.