Created
October 4, 2023 19:18
-
-
Save brunomarks7/0e0fee35f09f3360b496596ae425f6fa to your computer and use it in GitHub Desktop.
delayed function js
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
export function delay(min, max) { | |
const delayTime = Math.floor(Math.random() * (max - min + 1) + min) * 1000; | |
return new Promise((resolve) => { | |
setTimeout(resolve, delayTime); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment