---
hide_title: false
hide_table_of_contents: false
pagination_next: null
pagination_prev: null
---
# Symbol.unscopables

The **`Symbol.unscopables`** well-known symbol is used to specify an object value of whose own and inherited property names are excluded from the [`with`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/with) environment bindings of the associated object.

## Value

The well-known symbol `@@unscopables`.

## Description

The `@@unscopables` symbol (accessed via `Symbol.unscopables`) can be defined on any object to exclude property names from being exposed as lexical variables in [`with`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/with) environment bindings. Note that when using [strict mode](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Strict_mode), `with` statements are not available, and this symbol is likely not needed.

Setting a property of the `@@unscopables` object to `true` (or any [truthy](https://developer.mozilla.org/docs/Glossary/Truthy) value) will make the corresponding property of the `with` scope object _unscopable_ and therefore won't be introduced to the `with` body scope. Setting a property to `false` (or any [falsy](https://developer.mozilla.org/docs/Glossary/Falsy) value) will make it _scopable_ and thus appear as lexical scope variables.

When deciding whether `x` is unscopable, the entire prototype chain of the `@@unscopables` property is looked up for a property called `x`. This means if you declared `@@unscopables` as a plain object, `Object.prototype` properties like [`toString`](../../globals/Object/prototype/toString.mdx) would become unscopable as well, which may cause backward incompatibility for legacy code assuming those properties are normally scoped (see [an example here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/unscopables#avoid_using_a_non-null-prototype_object_as_symbol.unscopables)). You are advised to make your custom `@@unscopables` property have `null` as its prototype, like [`Array.prototype[Symbol.unscopables]`](../../globals/Array/prototype/@@unscopables.mdx) does.
