Global Symbol Registry
relationship between symbol values and their string keys
ES6 has a global resource for creating symbols: the symbol registry. The symbol registry provides us with a one-to-one relationship between strings and symbols. The registry returns symbols using Symbol.for( key )
.
Symbol.for( key1 ) === Symbol.for( key2 )
whenever key1 === key2
. This correspondance works even across service workers and iframes.
Get hands-on with 1400+ tech skills courses.