JavaScript Symbol.keyFor() Method

The JavaScript Symbol.keyFor() method uses the global symbol registry to look up the key for the symbol. So it doesn't work for non-global symbols. If the symbol is not global, it won't be able to find it and return undefined.

Syntax

Parameters

Symbol(required): The symbol to find a key.

Return value

A string representing the key for the given symbol if one is found on the global registry

Browser Support

Chrome40
Safari9
Firefox36
OperaYes

Example 1

Test it Now

Output:

JavaTpoint
Java

Example 2

Test it Now

Output:

true
Done





Latest Courses