Skip to content

Instantly share code, notes, and snippets.

@hugowetterberg
Forked from simme/callback_scoping.js
Created April 8, 2014 06:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hugowetterberg/10096214 to your computer and use it in GitHub Desktop.
Save hugowetterberg/10096214 to your computer and use it in GitHub Desktop.
function test() {
for (var i=0;i < 5;i++) {
console.log('orig: '+ i);
doStuff(i);
}
function doStuff(i) {
setTimeout(function debugLogging() {
console.log('cb: '+ i);
}, 100);
}
}
test();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment