C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript Symbol.unscopables PropertiesThe Java Symbol.unscopables symbol is an object value whose inherited property names are excluded from with environment bindings. NOTE:
Syntax
[Symbol.unscopables] Parameters
Object. Return valueCheck the variable appear in lexical scope variable. Browser Support
Example 1
//JavaScript to illustrate Symbol.toPrimitive
var obj = {
j: 1,
k: 2
};
obj[Symbol.unscopables] = {
//Setting a property to false will make it scopable
j: false,
//Setting a property to true in an unscopables object
k: true
};
with (obj) {
document.write(j);
}
//expected output: 1
Output: 1 Example 2
<script>
//JavaScript to illustrate Symbol.toPrimitive
var obj = {
j: "JavaTpoint",
k: "Core Java"
};
obj[Symbol.unscopables] = {
//Setting a property to false will make it scopable
j: false,
//Setting a property to true in an unscopables object
k: true
};
with (obj) {
document.write(j);
}
//expected output: JavaTpoint
</script>
Output: JavaTpoint
Next TopicJavaScript Symbol
|