+ 2
Can symbols in js be really reassigned?
In the code, let id = Symbol(); let user = { [id] : 12, }; user[id] = 14; alert(user[id]); Here, the value of symbol id is 14 on alert ie. Reassigned. But in specifications, they say symbols cannot be reassigned, so whats the concept here???
1 Answer
+ 4
Every symbol returned by Symbol() is unique, so every symbol has its own identity.
https://www.freecodecamp.org/news/how-did-i-miss-javascript-symbols-c1f1c0e1874a/