🔰await in parallel
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
JS ⟩ async ⟩ await ⟩ promises ⟩ in parallel
await promises in parallel.
replit:awaiting multiple promises, require: measureTime(), futureValue()
async function g() {
const p1 = futureValue(1, 2); // in 2 sec
const p2 = futureValue(2, 4); // in 4 sec
results
measureTime(g); // ⭐ 4.00 sec : g() -> 3
measureTime(h); // ⭐ 4.00 sec : h() -> 15