Symbol.keyFor

Returns a key from the global symbol registry matching the given Symbol if found. Otherwise, returns a undefined.

Syntax

keyFor(sym)

Parameters

Return value

A key as a string or undefined.

Examples

Symbol.keyFor(Symbol.for("peace"))
"peace"