You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Symbol.unscopables 是 ES6 引入的一个特殊的内置符号,用于指定在 with 语句块中哪些属性是不可见的。换句话说,它定义了对象中在 with 语句作用域中被排除的属性。
constobj={foo: 1,bar: 2,[Symbol.unscopables]: {foo: true,// foo 属性在 with 语句中不可见},};with(obj){console.log(foo);// ReferenceError: foo is not definedconsole.log(bar);// 2}
The text was updated successfully, but these errors were encountered:
Symbol.unscopables
是 ES6 引入的一个特殊的内置符号,用于指定在with
语句块中哪些属性是不可见的。换句话说,它定义了对象中在with
语句作用域中被排除的属性。The text was updated successfully, but these errors were encountered: