Created
March 8, 2022 08:31
-
-
Save wittawasw/711ab238ccf4e4eaf069087bf2bedefa to your computer and use it in GitHub Desktop.
Simple delay function in nodejs
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
// https://stackoverflow.com/questions/14249506/how-can-i-wait-in-node-js-javascript-l-need-to-pause-for-a-period-of-time | |
const delay = ms => new Promise(resolve => setTimeout(resolve, ms)) | |
await delay(1000) /// waiting 1 second. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment