Symbol.for
for registering Symbols globally
creates a new symbol (check via typeof
)
stores the symbol in a runtime-wide registry and retrieves it from there
is different to Symbol()
which creates a symbol every time and does not store it
.toString()
on a Symbol
also contains the key given to Symbol.for()
NOTE: the description of two different symbols
might be the same
but the symbols are not the same!
Related Katas
Symbol
- basics
Symbol.for()
Symbol.keyFor()
Difficulty Level
INTERMEDIATE
First Published
6 May 2015
Stats
6 tests to solve