Symbol.unscopables JavaScript

The JavaScript Symbol.unscopables property represents an object whose inherited property names are excluded from environment bindings. Its property can be set to true and false. The object would not appear in lexical scope variables if its property is set to true and it will appear in lexical scope variables if its property is set to false.

Syntax:

[Symbol.unscopables] 

Parameters: Object.

Example:

<!DOCTYPE html>
<html>
<body>
<script>
var display = {a: 1, b: 2};
display[Symbol.unscopables] = {b: false, a: true};
with (display) {document.write(b);}
</script>
</body>
</html>
Please follow and like us:
Content Protection by DMCA.com