Skip to content

Instantly share code, notes, and snippets.

@djD-REK
Created June 9, 2020 02:43
Show Gist options
  • Save djD-REK/1cda61a6c8ae3ef7a80713d44f4b8376 to your computer and use it in GitHub Desktop.
Save djD-REK/1cda61a6c8ae3ef7a80713d44f4b8376 to your computer and use it in GitHub Desktop.
const sleepNow = (delay) => new Promise((resolve) => setTimeout(resolve, delay))
async function repeatedGreetingsLoop() {
for (let i = 1; i <= 5; i++) {
await sleepNow(1000)
console.log(`Hello #${i}`)
}
}
repeatedGreetingsLoop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment