Skip to content

Instantly share code, notes, and snippets.

@HaloZero
Created May 26, 2011 23:21
Show Gist options
  • Save HaloZero/994336 to your computer and use it in GitHub Desktop.
Save HaloZero/994336 to your computer and use it in GitHub Desktop.
interview
function getValues() {
var x = new Array();
for(var i=0; i < 10; i++) {
x[i] = function() { return i; }
}
return x;
};
var values = getValues();
for(var j=0; j < values.length; j++) {
console.log(values[j]());
}
What does this do?
How would you fix it?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment