ES6 Symbol

Symbol is a new primitive data type introduced in ES6. It is unique and immutable, and can be created using the function Symbol. It can be used as unique keys in objects. See the example below


Global Symbols


Global symbols can be registered using function Symbol.for and the keys can be retrieved using Symbol.keyFor. These symbols will be global and will be created only once.

Share