Skip to content

Instantly share code, notes, and snippets.

@lannex
Last active September 27, 2019 08:34
Show Gist options
  • Save lannex/46c34d35ebed1a2301ea8f40f8331bcf to your computer and use it in GitHub Desktop.
Save lannex/46c34d35ebed1a2301ea8f40f8331bcf to your computer and use it in GitHub Desktop.
Async loops
async function parallel(array) {
const promises = array.map(item => delay(item));
await Promise.all(promises);
}
async function serial(array) {
for (const item of array) {
await delay(item);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment