Symbols are new primitive built-in object types introduced as part of ES6. Symbols return unique identifiers that can be used to add unique property keys to an object that won’t collide with keys of any other code that might add to the object. They are used as object properties that cannot be recreated. It basically helps us to enable encapsulation or information hiding.
Symbol( optional_string )
Parameters: The optional_string is an optional parameter that acts as a description of Symbol().
Return Value: This method returns a new Symbol object.
Below are the examples of the Symbol() method.