Member-only story
Understanding Symbols in JavaScript: A Guide to Unique and Powerful Object Keys
Unique Keys and Advanced Object Customization
In JavaScript, symbols are a unique and immutable primitive data type introduced in ES6 (ECMAScript 2015).
Symbols are often used to add unique property keys to an object that won’t collide with keys any other code might add to the object, and which are hidden from any mechanisms other code will typically use to access the object.

Dont have an active subscription read it here
Creating a Symbol
A Symbol is created using the Symbol()
function:
const sym1 = Symbol();
const sym2 = Symbol("desc");
const sym3 = Symbol("desc");
Key Features of Symbols
- Uniqueness: Every Symbol is guaranteed to be unique.
const sym1 = Symbol("desc");
const sym2 = Symbol("desc");
console.log(sym1 === sym2); // false
Even if two symbols have the same description, they are different.
Note that Symbol("
desc")
does not coerce the string "
desc"
into a Symbol. It creates a new Symbol each time