Introduction to the Symbol type in JavaScript

The Symbol type is designed to create unique identifiers. These identifiers can be used to create unique object keys.

Let's create a symbol as an example:

let sym = Symbol(); console.log(sym);

You can create several symbols:

let sym1 = Symbol(); let sym2 = Symbol(); console.log(sym1, sym2);

The symbols we create will be unique. This means that when compared, they will not be equal:

let sym1 = Symbol(); let sym2 = Symbol(); console.log(sym1 === sym2); // false

Create several symbols.

enru