Created
May 26, 2011 23:21
-
-
Save HaloZero/994336 to your computer and use it in GitHub Desktop.
interview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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