What Are Symbols, Really?

What Are Symbols, Really?
0.0 0


Quoted from MDN:

Every symbol value returned from Symbol() is unique. A symbol value may be used as an identifier for object properties; this is the data type’s only purpose. Some further explanation about purpose and usage can be found in the glossary entry for Symbol.

As I am a skeptic in all things, I have to wonder what “unique” means, and how it is accomplished. Does anyone know? I would assume that new symbols are checked against some kind of global Set, but what are they? Random letters and numbers? Something lower level?


Did you read the Wiki page.

In the most trivial implementation, they are essentially named integers (e.g. the enumerated type in C).

Does that help? Enums are unique I believe.