JS โฉ async โฉ await โฉ promises โฉ sequentially
await multiple promises sequentially.
replit๏ผawaiting multiple promises, require๏ผ measureTime(), futureValue()
async function f() { // โญ awaiting multiple promises "sequentially" const a = await futureValue(20, 2); // in 2 sec const b = await futureValue(30, 4); // in 4 sec return a + b; }
results
measureTime(f); // โญ 6.00 sec : f() -> 50
Promises in parallel
chaining Promises (in series)
JS.info โฉ async/await
Last updated 2 years ago
Was this helpful?