1. Basics of Asynchronous Programming
- What is Asynchronous Programming?
- Synchronous vs. Asynchronous.
- Blocking vs. Non-blocking code.
- Single-threaded Event Loop
- How JavaScript handles asynchronous tasks.
- Call Stack, Event Loop, Task Queue, and Microtask Queue.
2. Asynchronous Patterns
- Callbacks
- Callback Hell and its drawbacks.
- Promises
- Creating Promises.
.then() and .catch().
- Promise chaining.
.finally() method.
3. Advanced Promise Patterns
- Promise.all, Promise.race, Promise.any, and Promise.allSettled
- Handling multiple promises in parallel or selectively.
- Custom Promise Utilities
- Implementing your own
Promise.all or Promise.race.
4. Async/Await
- Introduction to Async/Await
- Replacing
.then() and .catch() with cleaner syntax.
- Error Handling with try/catch
- Graceful handling of rejections.
- Combining Async/Await with Promises
5. Event loop and Microtasks
- Event Loop Mechanics
- Role of the event loop in asynchronous programming.
- Task Queue (Macrotasks)
setTimeout, setInterval, setImmediate (Node.js).
- Microtask Queue
- Promises and
process.nextTick() (Node.js).