Skip to content

Instantly share code, notes, and snippets.

@happymishra
Last active June 16, 2019 06:53
Show Gist options
  • Save happymishra/257a289f17ceff75ceb070578795136c to your computer and use it in GitHub Desktop.
Save happymishra/257a289f17ceff75ceb070578795136c to your computer and use it in GitHub Desktop.
function printStatement() {
console.log("I will be printed after 100 milliseconds")
}
setTimeout(printStatement, 100)
/* ******* Alternate syntax ******************/
/*
setTimeout can be written as this also
setTimeout(fucntion(){
console.log("Hello")
}, 100)
*/
/* ******* Alternate syntax ******************/
console.log("I will be executed first")
/* Output:
I will be executed first
I will be printed after 100 milliseconds // After 100 millieconds
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment