Skip to content

Instantly share code, notes, and snippets.

@mnyamor
Created October 27, 2016 22:42
Show Gist options
  • Save mnyamor/671345eda67a2f1e9cb75200f8940511 to your computer and use it in GitHub Desktop.
Save mnyamor/671345eda67a2f1e9cb75200f8940511 to your computer and use it in GitHub Desktop.
Global timing functions - setTimeout
/*
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