Skip to content

Instantly share code, notes, and snippets.

@iamrommel
Created January 24, 2019 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamrommel/d43058f95ba37b0b9792a4eaa2834827 to your computer and use it in GitHub Desktop.
Save iamrommel/d43058f95ba37b0b9792a4eaa2834827 to your computer and use it in GitHub Desktop.
Sample of using async/await in loops with promise.all
async function updateAllCustomer(customers) {
const mapsPromises = customers.map(update);
//this will wait until all promise is resolved before going to next line
await Promise.all(mapsPromises);
console.log('Done!');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment