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