This file contains 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++){ | |
console.log(i); | |
} |
This file contains 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
var i = 0; | |
function forloop(){ | |
if(i<10){ | |
console.log(i); | |
i++; | |
setTimeout(forloop, 0); | |
} | |
} | |
forloop(); |
This file contains 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 forloop(i){ | |
if(i<10){ | |
console.log(i); | |
setTimeout(function(){ forloop(i+1); }, 0); | |
} | |
})(0); |
This file contains 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 a(){ | |
console.log("hello!"); | |
})(); |
This file contains 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(){ | |
// inner scope.. you can't touch me from outside! | |
var i = 0; | |
function forloop(){ | |
if(i<10){ | |
console.log(i); | |
i++; | |
setTimeout(forloop, 0); | |
} | |
} |
This file contains 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
$.getJSON('/data0.json', function(data) { | |
console.log("yay! Data0 is ready!"); | |
}); |
This file contains 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
$.getJSON('/data0.json', function(data) { | |
console.log("yay! Data0 is ready!"); | |
// ok, now use that to get the next piece of data. | |
$.getJSON('/data1.json', function(data) { | |
console.log("yay! Data1 is ready!"); | |
// ok, now use that to get the next piece of data. | |
$.getJSON('/data2.json', function(data) { | |
console.log("yay! Data2 is ready!"); | |
// ok, now use that to get the next piece of data. | |
$.getJSON('/data3.json', function(data) { |
This file contains 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(){ | |
var i = 0; | |
function forloop(){ | |
if(i<5){ | |
$.getJSON('/data'+i+'.json', function(data) { | |
console.log("yay! Data"+i+" is ready!"); | |
i++; | |
forloop(); | |
}); | |
}else{ |
This file contains 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++){ | |
for(var j=0; j<10; j++){ | |
console.log(i,j); | |
} | |
} | |
console.log("all done."); |
This file contains 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(){ | |
var i = 0; | |
function forloop1(){ | |
if(i<10){ | |
(function(){ | |
var j = 0; | |
function forloop2(){ | |
if(j<10){ | |
console.log(i,j); | |
j++; |
OlderNewer