---
hide_title: false
hide_table_of_contents: false
pagination_next: null
pagination_prev: null
---
# Symbol.keyFor()

The **`Symbol.keyFor(sym)`** method retrieves a shared symbol
key from the global symbol registry for the given symbol.

## Syntax

```js
Symbol.keyFor(sym)
```

### Parameters

- `sym`
  - : Symbol, required. The symbol to find a key for.

### Return value

A string representing the key for the given symbol if one is found on the [global registry](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol#shared_symbols_in_the_global_symbol_registry); otherwise, [`undefined`](../../globals/undefined.mdx).
