Using async for JavaScripts
Using async in JavaScript means writing asynchronous code with async and await and calling network APIs with fetch. An async function returns a promise, and await pauses it until the result is ready. This unit in the Asynchronous JavaScript stage covers sequencing requests, parsing JSON and handling errors.
Stage: Asynchronous JavaScript · Part of the JavaScript roadmap · Last reviewed 19 November 2026
What to learn in Using async
- Rewrite a promise chain using async and await with try and catch
- Call an API with fetch and read the response as JSON
- Check response.ok because fetch does not reject on HTTP error codes
- Run independent requests in parallel instead of awaiting them one by one
- Send a POST request with headers and a JSON body
Using async interview questions
Does fetch reject on a 404 or 500 response?
No. fetch only rejects on network failure or aborted requests. For HTTP errors the promise resolves, so you must check response.ok or response.status and throw yourself. Many beginner bugs come from assuming a failed status goes to catch.
What does the await keyword actually do?
await pauses the async function until the promise settles, then returns its value or throws its rejection. It does not block the thread, because other code keeps running meanwhile. It can only be used inside async functions or at the top level of modules.
Where Using async fits in the JavaScript roadmap
Using async belongs to the Asynchronous JavaScript stage (beginner level), which takes about 28 hours. Work with time and the network.
Other units in this stage
Back to the full JavaScript roadmap