Created
October 30, 2018 18:07
-
-
Save viniciusmelocodes/ac4dc5d27fc5bb5c8b611f74bdc87456 to your computer and use it in GitHub Desktop.
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 sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} | |
async function demo() { | |
console.log('Taking a break...'); | |
await sleep(2000); | |
console.log('Two seconds later'); | |
} | |
demo(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment