Skip to content

Instantly share code, notes, and snippets.

@ever-dev
Last active November 8, 2020 17:22
Show Gist options
  • Save ever-dev/6764d696703953f41e45f572b54d3062 to your computer and use it in GitHub Desktop.
Save ever-dev/6764d696703953f41e45f572b54d3062 to your computer and use it in GitHub Desktop.
Call asynchronous functions in sequence
const arr = [...];
arr.reduce((p, cur) => {
return p.then(()=> {
return doSomething(cur);
});
}, Promise.resolve());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment