Asynchronous JavaScript for Frontend Developers
Asynchronous JavaScript is how the language handles work that finishes later, such as network calls and timers, without freezing the page. The event loop runs one task at a time and picks up callbacks, promises and async/await continuations from queues when the call stack is empty.
Stage: JavaScript and TypeScript · Part of the Frontend Developer roadmap · Last reviewed 19 November 2026
What to learn in Asynchronous JavaScript
- Predict the order of output from setTimeout, promises and synchronous code
- Convert a callback-based function into one that returns a promise
- Write async functions with try and catch for failed requests
- Run requests in parallel with Promise.all and handle one failing
- Cancel an in-flight fetch with an AbortController
Asynchronous JavaScript interview questions
Why does a promise callback run before a setTimeout of zero?
Promise callbacks go into the microtask queue, which the event loop drains completely after the current task. A setTimeout callback goes into the macrotask queue and waits for the next turn. So microtasks always run first, even when the timer delay is zero.
What is the difference between Promise.all and Promise.allSettled?
Promise.all resolves with every result only if all promises succeed, and rejects as soon as one fails. Promise.allSettled always waits for all of them and returns a status and value or reason for each. Use it when partial failure is acceptable.
Where Asynchronous JavaScript fits in the Frontend Developer roadmap
Asynchronous JavaScript belongs to the JavaScript and TypeScript stage (beginner level), which takes about 5 hours. The language of the browser, and the type system that keeps large codebases sane.
Other units in this stage
Back to the full Frontend Developer roadmap