Created
September 1, 2022 18:16
-
-
Save mateusfg7/115ef42b3e6c253b0888f9a56c221ad0 to your computer and use it in GitHub Desktop.
sleep function for javascrpt
This file contains 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
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