Skip to content

Instantly share code, notes, and snippets.

@mateusfg7
Created September 1, 2022 18:16
Show Gist options
  • Save mateusfg7/115ef42b3e6c253b0888f9a56c221ad0 to your computer and use it in GitHub Desktop.
Save mateusfg7/115ef42b3e6c253b0888f9a56c221ad0 to your computer and use it in GitHub Desktop.
sleep function for javascrpt
const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms))
await sleep(300) // will pause program for 3 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment