Skip to content

Instantly share code, notes, and snippets.

@MauricioRobayo
Last active January 31, 2023 16:19
Show Gist options
  • Select an option

  • Save MauricioRobayo/4c9b49146123d26e94b9e86aadfeaa22 to your computer and use it in GitHub Desktop.

Select an option

Save MauricioRobayo/4c9b49146123d26e94b9e86aadfeaa22 to your computer and use it in GitHub Desktop.
Parallel async await
const p1Promise = p1();
const p2Promise = p2();
const r1 = await a1;
const r2 = await a2;
const promises = [p1, p2].map(async (p) => {
const r = await p();
return r * 10;
});
Promise.all(promises)
for await (const p of [p1(), p2()]) {
console.log(p);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment