Created
March 10, 2010 18:53
-
-
Save mneedham/328201 to your computer and use it in GitHub Desktop.
This file contains hidden or 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(); | |
| console.log(values) | |
| for(var j=0; j < values.length; ++j) { | |
| console.log(values[j]()); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment