Returns the symbol for a specified key or, if the key is not present, creates a new symbol object with the new key.
Syntax
Symbol.for(key);
Parameters
key
Required. The key for the symbol, which is also used as the description.
Remarks
This method searches for the symbol in the global symbol registry. If you serialize symbols as strings, use the global symbol registry to make sure that a particular string maps to the correct symbol for all lookups.
Example
var sym = Symbol.for("desc");
console.log(sym.toString());
// Two different object references.
console.log(Symbol("symbol") === Symbol.for("symbol");)
// Single object reference.
console.log(Symbol.for("symbol") === Symbol.for("symbol");)
// Output:
// Symbol(desc);
// false
// true
Requirements
Supported in Microsoft Edge (Edge browser). Also supported in Store apps (Microsoft Edge on Windows 10). See Version Information.
Not supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Not supported in Windows 8.1.

