jskatas.org Continuously Learn JavaScript. Your Way.

Symbol: Symbol.keyFor()

Symbol.keyFor() gets the symbol key for a given symbol.

Donate to NGO Julenka. Support Ukranians in need. Julenka is an NGO which my brother founded in 2011 to support Ukranian families and kids in need.

Symbol.keyFor() gets the symbol key for a given symbol

  • pass the symbol to keyFor() and you get its key
  • local symbols are not in the runtime-wide registry
  • predefined symbols are not in the runtime-wide registry either
  • for non-Symbols throws an error