A Symbol is a primitive data type whose instances are unique and immutable. In some programming languages they are also called atoms.
In JavaScript, Symbol is one of the primitive values and the Symbol
object is a wrapper around a Symbol primitive.
Symbol can have an optional description, but for debugging purposes only.
Symbol type is a new feature in EcmaScript 6 (es6) and there is no EcmaScript 5 equivalent for symbol.
Symbol("foo") !== Symbol("foo") const foo = Symbol() const bar = Symbol() typeof foo === "symbol" typeof bar === "symbol" let obj = {} obj[foo] = "foo" obj[bar] = "bar" JSON.stringify(obj) // {} Object.keys(obj) // [] Object.getOwnPropertyNames(obj) // [] Object.getOwnPropertySymbols(obj) // [ foo, bar ]