Symbol Playground

Wax seals at Bayu’s counter: are two Symbol("x") equal? Use a seal as a drawer’s key, then see who sees it, Object.keys, JSON or Reflect.ownKeys, and what…

Why it matters

A Symbol is a key that cannot clash: a library can hang data on someone else’s object without overwriting anything, and that data stays out of Object.keys and JSON. Symbols are also what the language’s protocols are built on (Symbol.iterator), and Symbol.for is how parts of a program share one Symbol.

The key idea

A Symbol is a value that equals only itself

Common mistakes

Try it in this playground