Skip to content

Instantly share code, notes, and snippets.

@iksose
Last active August 29, 2015 14:00
Show Gist options
  • Save iksose/11048662 to your computer and use it in GitHub Desktop.
Save iksose/11048662 to your computer and use it in GitHub Desktop.
function inNetwork(){
var thingie = 0
var next = function(){
console.log("herp", thingie)
thingie++
if(thingie < 10)
//registers next
setTimeout(next, 0);
}
//registers first
setTimeout(next, 0);
}
function inNetwork2(){
var thingie = 0
var next = function(){
console.log("derp", thingie)
thingie++
if(thingie < 10)
setTimeout(next, 0);
}
setTimeout(next, 0);
}
inNetwork()
console.log("Starting 1")
inNetwork2()
console.log("Starting 2")
// Starting 1
// Starting 2
// Herp 0
// Derp 0
// Herp 1
// Derp 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment