TopLevel
Class Symbol
Object
Symbol
Symbol is a primitive data type that can serve as object properties. Symbol instance can be created explicitly or via a global registry, see for(String).
API Versioned:
From version 21.2.
Constants
hasInstance  :  Symbol
The symbol used by instanceof.
isConcatSpreadable  :  Symbol
The symbol used by Array.concat(Object...).
iterator  :  Symbol
The symbol used by for...of.
match  :  Symbol
The symbol used by String.match(RegExp).
replace  :  Symbol
The symbol used by String.replace().
search  :  Symbol
The symbol used by String.search(RegExp).
species  :  Symbol
The symbol used to create derived objects.
split  :  Symbol
The symbol used by String.split().
toPrimitive  :  Symbol
The symbol used to convert an object to a primitive value.
toStringTag  :  Symbol
The symbol used by Object.toString().
unscopables  :  Symbol
The symbol used by with.
Properties
Constructor Summary
Symbol()
Creates a new symbol.
Symbol(description : String)
Creates a new symbol.
Method Summary
static for(key : String) : Symbol
Obtains a symbol from the global registry.
static keyFor(symbol : Symbol) : String
Returns the key within the global symbol registry under which the given symbol is stored.
Constructor Detail
Symbol
public Symbol()
Creates a new symbol. Note that it must be called without new. Symbols created via this method are always distinct.

Symbol
public Symbol(description : String)
Creates a new symbol. Note that it must be called without new. Symbols created via this method are always distinct.
Parameters:
description - A description for this symbol.

Method Detail
for
static for(key : String) : Symbol
Obtains a symbol from the global registry. If no symbol exists for the key within the registry a new symbol is created and stored in the global registry.
API Versioned:
From version 21.2.
Parameters:
key - The key for a symbol within the global registry.
Returns:
The found or newly created symbol.

keyFor
static keyFor(symbol : Symbol) : String
Returns the key within the global symbol registry under which the given symbol is stored.
Parameters:
symbol - The symbol to look for.
Returns:
The key for the given symbol if the symbol is known to the global registry, else return undefined.