I don't know Coffeescript - does it implicitly create a local var when there is already a global with the same name?
In this case as long as OP was not using the variable in an enclosing scope, it would have been made local to the function.
->
outerVar = "outer"
->
# this will output "undefined"
# as CoffeeScript has redeclared it for the loop:
console.log outerVar
0 for outerVar in [0]