Skip to content

Instantly share code, notes, and snippets.

@cornedor
Last active December 15, 2015 19:19
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 cornedor/5310864 to your computer and use it in GitHub Desktop.
Save cornedor/5310864 to your computer and use it in GitHub Desktop.
var i = 0;
function loop(callback)
{
if(++i > 10) return callback === undefined ? undefined : callback();
console.log(i);
setTimeout(function(){loop(callback);}, 200);
}
loop(function(){console.log('done');});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment