Javatpoint Logo
Javatpoint Logo

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

Chrome 40
Safari 9
Firefox 36
Opera Yes

Example 1

Test it Now

Output:

JavaTpoint
Java

Example 2

Test it Now

Output:

true
Done

Next TopicJavaScript Symbol





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA