Skip to content

Instantly share code, notes, and snippets.

@jkeefe
Created January 29, 2023 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkeefe/dca073de46453a648b9dd9896be08b85 to your computer and use it in GitHub Desktop.
Save jkeefe/dca073de46453a648b9dd9896be08b85 to your computer and use it in GitHub Desktop.
Node delay function
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