What Are the Advantages of Using Symbols ?
Problem
You want to know why and how to use symbols in a project.
Solution
Symbols give you the ability to create unique tokens that will never clash with other symbols. Similar to UUIDs (Universal Unique Identifiers) , symbols can be used on objects to make unique properties.
The Code
Listing 15-1. Creating Symbols
let mySym1 = Symbol('This is my first Symbol');
let mySym2 = Symbol(); //returns false
console.log(mySym1 == mySym2);
console.log(mySym1.toString()) //returns Symbol(This is my first Symbol) ...