Skip to content

Instantly share code, notes, and snippets.

@surendharreddy
Created February 26, 2021 13:15
Show Gist options
  • Select an option

  • Save surendharreddy/c8215fa4e3aec536acca4a61294bda8a to your computer and use it in GitHub Desktop.

Select an option

Save surendharreddy/c8215fa4e3aec536acca4a61294bda8a to your computer and use it in GitHub Desktop.
const delay = (ms) => new Promise((res) => setTimeout(res, ms));
async function execute(count = 0) {
for (let i = 1; i < count; i++) {
// Run logic here
await delay(i * 1000);
}
}
execute(10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment