-
-
Save hughfdjackson/2836182 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
for (var i = 0; i < 10; i++) { | |
process.nextTick(function (i) { console.log(i); }.bind(this, i)); | |
} | |
// Prints 10 x 10 times | |
// I want it to print 1 - 10 without using an external array to store i | |
/* | |
In browser test edition | |
var process = {} | |
process.nextTick = function(fn){ | |
setTimeout(fn, 1) | |
} | |
for (var i = 0; i < 10; i++) { | |
process.nextTick(function (i) { console.log(i); }.bind(this, i)); | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment