Skip to content

Instantly share code, notes, and snippets.

@dezinezync
Created February 9, 2017 08:23
Show Gist options
  • Save dezinezync/9bd7ed6ba5c2aff59c04addc536d5c42 to your computer and use it in GitHub Desktop.
Save dezinezync/9bd7ed6ba5c2aff59c04addc536d5c42 to your computer and use it in GitHub Desktop.
Run N Promises sequentially, irrespective of whether the previous promise passed or failed.
const run = () => +new Date()
let arr = Array.from({length: 100}, run)
arr.reduce((x, y) => {
x.then(result => {
console.log(x)
return y
}, err => {
console.error(err)
return y
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment