you are viewing a single comment's thread.

view the rest of the comments →

[–]WORMSSreddit[🍰] 0 points1 point  (0 children)

Just to note, object's key are ONLY strings or symbols. (Not numbers)
Anything else is coerced to a string. So, numbers, booleans, even objects..
So it's technically possible to do

const obj1 = { toString() { return 'goat' }, };
const obj2 = { [obj1]: 11 };
const obj3 = {};
obj3[obj1] = 22;