Created
October 27, 2016 22:42
-
-
Save mnyamor/671345eda67a2f1e9cb75200f8940511 to your computer and use it in GitHub Desktop.
Global timing functions - setTimeout
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
/* | |
Working with Node.js asynchronously through the use of timing functions. | |
The timing functions are:- setTimeout, clearTimeout, setInterval, and clearInterval | |
- setTimeout will create a delay of a certain time and then invoke a callback function | |
*/ | |
var waitTime = 3000; | |
console.log("wait for it"); | |
setTimeout(function(){ | |
//after 3 seconds, we should see the output 'done' and the application exits | |
console.log("done"); | |
}, waitTime); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment