for (var i = 0; i < some_array.length; i++) { // Declaring this in the loop creates a one variable for // all instances of the loop. let x = some_array[i]; closures.push(function () { // Do something using x. I'll just return it. return x; }); } // now works as expected