Created
September 18, 2021 23:52
-
-
Save justinsbarrett/f25e8d21cdb919944d8a794e57b5c377 to your computer and use it in GitHub Desktop.
Delay timer
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
/** | |
* Delay execution a specified number of seconds. | |
* @param {number} seconds | |
*/ | |
function delay(seconds) { | |
const startTime = Date.now() | |
while (Date.now() - startTime < seconds * 1000) | |
continue | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment