Writing async functions; try/catch; parallel vs sequential
Create async functions, await results, catch errors, and compare sequential vs parallel patterns.
Intro to async/await
Goal: Use async/await safely.
- Create async functions
- Await values
- try/catch errors
- Parallel vs sequential

Tiny Promise helper
Create a tiny Promise-based helper to test awaits.
// delay returns a Promise that resolves after ms
function delay(ms, value) {
return new Promise(function (resolve) {
setTimeout(function () { resolve(value); }, ms);
});
}
// Example usage
delay(10, "ok").then(function (v) {
console.log("delay:", v);
});

All lessons in this course
- Writing async functions; try/catch; parallel vs sequential
- Timeouts & Aborting with AbortController
- Retrying & Backoff Patterns