I\'m reading the Mozilla developer\'s site on closures, and I noticed in their example for common mistakes, they had this code:
Helpful
New scopes are only created in function blocks (and with, but don't use that). Loops like for don't create new scopes.
function
with
for
So even if you declared the variable outside the loop, you would run into the exact same problem.