Enumeration WellKnownSymbolsConst

Identifies the Symbol static properties which are symbols themselves as a constant enum to aid in minification when fetching them from the global symbol implementation.

See: Well Known Symbols

Enumeration Members

asyncIterator

The Symbol.asyncIterator symbol is a builtin symbol that is used to access an object's @@asyncIterator method. In order for an object to be async iterable, it must have a Symbol.asyncIterator key.

See: Symbol.asyncIterator

hasInstance

The Symbol.hasInstance well-known symbol is used to determine if a constructor object recognizes an object as its instance. The instanceof operator's behavior can be customized by this symbol.

See: Symbol.hasInstance

isConcatSpreadable

The @@isConcatSpreadable symbol (Symbol.isConcatSpreadable) can be defined as an own or inherited property and its value is a boolean. It can control behavior for arrays and array-like objects:

  • For array objects, the default behavior is to spread (flatten) elements. Symbol.isConcatSpreadable can avoid flattening in these cases.
  • For array-like objects, the default behavior is no spreading or flattening. Symbol.isConcatSpreadable can force flattening in these cases.

See: Symbol.isConcatSpreadable

iterator

Whenever an object needs to be iterated (such as at the beginning of a for..of loop), its @@iterator method is called with no arguments, and the returned iterator is used to obtain the values to be iterated.

See: Symbol.iterator

match

This function is also used to identify if objects have the behavior of regular expressions. For example, the methods String.prototype.startsWith(), String.prototype.endsWith() and String.prototype.includes(), check if their first argument is a regular expression and will throw a TypeError if they are. Now, if the match symbol is set to false (or a Falsy value), it indicates that the object is not intended to be used as a regular expression object.

See: Symbol.match

matchAll

The Symbol.matchAll well-known symbol returns an iterator, that yields matches of the regular expression against a string. This function is called by the String.prototype.matchAll() method.

See: Symbol.matchAll

replace

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.

For more information, RegExp.prototype[@@replace]() and String.prototype.replace().

See: Symbol.replace

search

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.

For more information, see RegExp.prototype[@@search]() and String.prototype.search().

See: Symbol.species

species

The well-known symbol Symbol.species specifies a function-valued property that the constructor function uses to create derived objects. See: Symbol.species

split

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.

For more information, see RegExp.prototype[@@split]() and String.prototype.split(). See: Symbol.split

toPrimitive

With the help of the Symbol.toPrimitive property (used as a function value), an object can be converted to a primitive value. The function is called with a string argument hint, which specifies the preferred type of the result primitive value. The hint argument can be one of "number", "string", and "default".

See: Symbol.toPrimitive

toStringTag

The Symbol.toStringTag well-known symbol is a string valued property that is used in the creation of the default string description of an object. It is accessed internally by the Object.prototype.toString() method.

See: Symbol.toStringTag

unscopables

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.

See: Symbol.unscopables