3 ms·
I'm pretty sure I understand lexical scoping, and this ain't it: function foo() { window.c = "really?" d = {}; function bar() { v
by munificent 13y ago
I'm pretty sure I understand lexical scoping, and this ain't it:
function foo() {
window.c = "really?"
d = {};
function bar() {
var a = "var";
{
with (d) {
var a = b;
}
}
console.log(a);
}
d.b = c;
bar();
}
foo();
- kragen 13y agoYou are of course correct about with() being dynamically scoped; thank you. I had forgotten about with() when I wrote what I wrote. I must weaken my claim to "JS is lexically scoped, except for the with() construct."