Skip to content

Instantly share code, notes, and snippets.

@wittawasw
Created March 8, 2022 08:31
Show Gist options
  • Save wittawasw/711ab238ccf4e4eaf069087bf2bedefa to your computer and use it in GitHub Desktop.
Save wittawasw/711ab238ccf4e4eaf069087bf2bedefa to your computer and use it in GitHub Desktop.
Simple delay function in nodejs
// 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