The main purpose of Symbol
is to serve as a unique identifier for object properties
- Symbols are immutable, and unique.
let sym2 = Symbol("key");
let sym3 = Symbol("key");
sym2 === sym3; // false, symbols are unique
Nov 05, 20231 min read
The main purpose of Symbol
is to serve as a unique identifier for object properties
let sym2 = Symbol("key");
let sym3 = Symbol("key");
sym2 === sym3; // false, symbols are unique