TIL JS Symbols
POSTED ON:
TAGS: javascript
Symbol, introduced in ECMAScript 2015, is a primitive data type of JavaScript, along with string, number, boolean, null and undefined.
Symbols are almost exclusively used as special keys on objects:
hitchhikersGuide[ Symbol("meaning of life") ]; // 42
You won't encounter direct usage of symbols very often in typical JS programs. They're mostly used in low-level code such as in libraries and frameworks.
Related TILs
Tagged: javascript