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
(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 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
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
for(var i=0; i<10; i++){ | |
console.log(i); | |
} |
NewerOlder