4 ms·
Second example in tip #2 is dead wrong. JavaScript does NOT do Dymanic Scoping. I suspect he didn't even bother to run the code. His example throws an error wh
by makkerdam 12y ago
Second example in tip #2 is dead wrong. JavaScript does NOT do Dymanic Scoping.
I suspect he didn't even bother to run the code. His example throws an error when I try it: "ReferenceError: x is not defined" (as expected).
blind-leading-the-blind etc.
- Bahamut 12y agoThe first example is wrong as well I believe - there is never a function call of bar.
- dmak 12y agoI came here to say this.
- deleted 12y ago[deleted]
- ajanuary 12y agoI had to read that paragraph several times to see if they said "But Javascript doesn't do this." Nope, not in there at all.
- CountHackulus 12y agoWhile you're correct that the example is incorrect, technically speaking there are places where javascript does do dynamic scoping. Namely in a "with" or with "eval".