Created
April 10, 2017 03:30
-
-
Save JBarna/0648834ea106dff072cf0bc14ffc6bd9 to your computer and use it in GitHub Desktop.
Example of JavaScript asyncronous nature
This file contains hidden or 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++ ){ | |
setTimeout( function() { | |
console.log( "value is " + i); | |
}, 1000); | |
} | |
// what will the output be? | |
// go to https://goo.gl/lFkgcr to run the code | |
// setTimeout will call the first argument, a function, at the specified milliseconds. | |
// it's asyncronous, so the code around it is going to keep running in the meantime |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment