Skip to content

Instantly share code, notes, and snippets.

@ziyunfei
ziyunfei / @@unscopables.js
Created July 4, 2014 08:21
@@unscopables
var x = 1, y = 2, obj = {x:3, y:4}
with(obj) {
console.log(x, y) // 3, 4
obj[Symbol.unscopables] = {
x: true,
y: true
}
console.log(x, y) // 1, 2
}