Moved 'var' out of 'for (var i = 0; ...)'.
This was not a syntax error but unencouraged because of 'hoisting of variables'.