Skip to content

Instantly share code, notes, and snippets.

@brunomarks7
Created October 4, 2023 19:18
Show Gist options
  • Save brunomarks7/0e0fee35f09f3360b496596ae425f6fa to your computer and use it in GitHub Desktop.
Save brunomarks7/0e0fee35f09f3360b496596ae425f6fa to your computer and use it in GitHub Desktop.
delayed function js
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