November 2019
Beginner
804 pages
20h 1m
English
The key issue (pun intended) that we mentioned previously can actually easily be avoided by leveraging ECMAScript symbols, a new primitive type that was introduced with ES2015 and is now well supported in all modern web browsers.
Symbols are interesting because every single one of them is unique; you cannot create the same Symbol twice:
const foo: Symbol = Symbol(); const bar: Symbol = Symbol(); console.log(foo === bar); // false
In the preceding example, foo and bar are not the same! A symbol is a primitive type that can't be recreated, unlike strings and numbers, for example. However, it shares the immutability property of the other primitives: once a symbol has been created, it cannot be modified. ...
Read now
Unlock full access