The only solution I could think of is this:
function foo(n) {
var result = [];
for (var i = 0; i < n; i++)
(function(j) { result.push(function() { return j; }); })(i);
return result;
}
What are the two others?