June 2018
Beginner
288 pages
6h 31m
English
JavaScript previously had five primitive types: number, string, boolean, null, and, undefined; now it has one more. Symbol is a new primitive type in JavaScript intended for limited specialized use. Symbols can be used for three distinct purposes:
To define properties for objects in such a way they don’t appear during normal iteration—these properties are not private; they’re just not easily discovered like other properties.
To easily define a global registry or dictionary of objects.
To define some special well-known methods in objects; this feature, which fills the void of interfaces, is arguably one of the most important purposes of Symbol.
Interfaces in languages like Java and C# are useful for design by contract ...