Async JavaScript & Fetch
Coordinate asynchronous work with promises and async/await, and fetch data from HTTP APIs with robust loading, error and cancellation handling.
4 objectives 6 steps about 135 min
Learn it step by step
Read the lessons in order, try the practice checks, then prove the skill with the knowledge check.
This skill page is a public outline. Its lessons and knowledge check appear here as subject-matter experts approve them.
Learning objectives
- Explain how the event loop schedules tasks and microtasks and predict the execution order of mixed synchronous, promise and timer code.
- Write promise-based code with async/await, running independent requests in parallel with Promise.all or Promise.allSettled and handling every rejection.
- Call a JSON HTTP API with fetch: check response.ok, distinguish HTTP errors from network failures, parse the body, and send JSON with the correct method and headers.
- Cancel or ignore stale requests with AbortController and show loading, empty, error and retry states to the user.
Lesson plan
6 steps, about 135 min · 5 of 5 lessons available so far
- The Event Loop: Tasks, Microtasks and Rendering Concept · 20 min
- Promises and async/await Without Surprises Worked example · 25 min
- Talking to an HTTP API with fetch Worked example · 25 min
- Cancellation, Debouncing and Out-of-Order Responses Concept · 20 min
- Lab: Search-as-You-Type Against a Public API Lab · 30 min
- Check: Execution Order and Failure Modes Knowledge check · 8 questions
Practise it
Build a search-as-you-type UI against a public JSON API that debounces input, aborts the in-flight request when the query changes, shows loading, empty and error states with a retry button, and never displays results for an outdated query.
Build it from scratch
Practice builds that exercise this skill by re-creating a real technology.
- Build your own PromiseIntro · 3–6 h
References
Hard prerequisites
Unlocks
On these roadmaps
Progress and evidence for this skill are shared across all of them.