A symbol is a unique and immutable data type. It may be used as an identifier for object properties. The Symbol object is an implicit object wrapper for the symbol primitive data type.
The Symbol.for(key) method searches for existing symbols in a runtime-wide symbol registry with the given key and returns it if found. Otherwise a new symbol gets created in the global symbol registry with this key.
The Symbol.isConcatSpreadable well-known symbol is used to configure if an object should be flattened to its array elements when using the Array.prototype.concat() method.
The Symbol.iterator well-known symbol specifies the default iterator for an object. Used by for...of.
The Symbol.keyFor(sym) method retrieves a shared symbol key from the global symbol registry for the given symbol.
The Symbol.match well-known symbol specifies the matching of a regular expression against a string. This function is called by the String.prototype.match() method.
The Symbol.prototype property represents the prototype for the Symbol constructor.
The Symbol.replace well-known symbol specifies the method that replaces matched substrings of a string. This function is called by the String.prototype.replace() method.
The Symbol.search well-known symbol specifies the method that returns the index within a string that matches the regular expression. This function is called by the String.prototype.search() method.
The Symbol.species well-known symbol specifies a function valued property that is the constructor function that is used to create derived objects.
The Symbol.split well-known symbol specifies the method that splits a string at the indices that match a regular expression. This function is called by the String.prototype.split() method.
The Symbol.toPrimitive is a symbol that specifies a function valued property that is called to convert an object to a corresponding primitive value.
The toSource() method returns a string representing the source code of the object.
The Symbol.unscopables well-known symbol is used to specify an object value of whose own and inherited property names are excluded from the with environment bindings of the associated object.
The [@@toPrimitive]() method converts a Symbol object to a primitive value.
The Symbol.hasInstance well-known symbol is used to determine if a constructor object recognizes an object as its instance. The instanceof operator behavior can be customized by this symbol.
The toString() method returns a string representing the specified Symbol object.
The valueOf() method returns the primitive value of a Symbol object.