Created
April 26, 2024 15:03
-
-
Save AleixMT/ada9e300df47fadab87b988f46e43ce8 to your computer and use it in GitHub Desktop.
A basic implementation of the sleep function in JS
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
function sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} | |
sleep(1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment