Created
January 29, 2023 21:23
-
-
Save jkeefe/dca073de46453a648b9dd9896be08b85 to your computer and use it in GitHub Desktop.
Node delay function
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
function delay(time) { | |
return new Promise(resolve => setTimeout(resolve, time)); | |
} | |
// usage: | |
console.log("Thing one") | |
await delay(2000) | |
console.log("Thing two, two seconds later") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment