Re:Advanced JavaScript Techniques
by ams6110 on Friday October 09, 2009 @08:16PM
(#872716)
But don't make the mistake of assuming that when writing "for (var i=...)" that i is scoped to the loop block. JavaScript does not have block scope. It only has function scope, with the "Global Object" scope being the top level scope.
[ Parent
| on HN ]
Only with JS <1.7. Otherwise you get block scope by using 'let instead of 'var.