Creating Unique Symbols
Generate guaranteed-unique values.
What Is a Symbol
A Symbol is a primitive type introduced in modern JavaScript. Every symbol is unique, even if two symbols share the same description.
const s = Symbol()
console.log(typeof s)Creating a Symbol
You create a symbol by calling the Symbol function. It is not a constructor, so you never use new with it.
const id = Symbol()
console.log(typeof id)All lessons in this course
- Creating Unique Symbols
- Symbols as Object Keys
- The Global Symbol Registry
- Well-Known Symbols