Day 13 of 14 35 minEvent loopPromisesasync / awaitfetch
Some work takes time, like network requests, timers and files. Learn how JavaScript keeps going while it waits, using the event loop, callbacks, promises and async/await, and how to run tasks in parallel and handle their errors.
By the end of today you can
- Explain why JavaScript needs asynchronous code and how the event loop works
- Predict the order of output with setTimeout and promises
- Create and use promises with then and catch
- Write async functions with await and try/catch
- Run tasks in parallel with Promise.all and fetch data from an API
What's inside
- 6 sections
- 3 diagrams and mind maps
- 5 code examples you can run
- 5-question quiz
- 1The event loop
- 2Callbacks: the original way
- 3Promises
- 4async and await
- 5Running tasks in parallel
- 6Real requests with fetch
Sign in free to read this lesson
Get the full lesson with diagrams, runnable code and the quiz. Your progress is saved across devices.
Sign in free