Hacker News new | ask | show | jobs
by daleharvey 5597 days ago
That error would have happened despite if the var was declared at the top or in the loop

    addEventListener("stuff", function() {
        return function(index) {
            alert(index);
        }
    }(i);
is the fix, either way
1 comments

Yeah. I meant that the mistake is less likely to have been made in the first place.