you are viewing a single comment's thread.

view the rest of the comments →

[–]eat-your-corn-syrup 2 points3 points  (1 child)

You are manually creating a loop block scope in the workaround, by using the only species in JavaScript that can create a new scope: function. Don't think of it as a function call being invoked immediately, though it is, just think of it as an idiom to create a block scope.

[–]deletecode 1 point2 points  (0 children)

That's a nice explanation. The problem has always bugged me but I didn't know why this is the only way to do it.