Skip to content

Instantly share code, notes, and snippets.

@itacirgabral
Created September 4, 2020 13:56
Show Gist options
  • Save itacirgabral/c906f57928ae9292fceee506b8f074b0 to your computer and use it in GitHub Desktop.
Save itacirgabral/c906f57928ae9292fceee506b8f074b0 to your computer and use it in GitHub Desktop.
const delay = (delta) =>
new Promise((resolve, reject) => {
setTimeout(() => resolve(), delta)
})
const d1 = delay(300).then(() => {
console.log('1')
return delay(300)
})
const d2 = d1.then(() => {
console.log('2')
return delay(300)
})
const d3 = d2.then(() => {
console.log('3')
return delay(300)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment