DEV Community

Discussion on: What are SYMBOLS in Javascript ?

Collapse
 
amt8u profile image
amt8u

I understand the differences between symbols and string based keys on object but somehow I am yet not clear why symbols exist.

In terms of non-enumerable properties we can have those with regular objects too. Like we have the length property with any array.

If we talk about sharing objects between libraries, I guess its a not a good idea where different libraries are trying to add properties with same key. If that is happening, probably we are doing something wrong somewhere.

It would be great if you could put out some real world examples where symbols are practically used.