JSVerse
Async & Browser JS / Fetch

fetch & JSON

Requesting data over the network, promise-based from start to finish.

`fetch()` returns a promise that resolves once the response headers arrive — not once the full body is downloaded. Reading the body (as JSON, text, etc.) is a second, separate asynchronous step via `response.json()`, which also returns a promise. Both steps are usually awaited in sequence.

Codeeditable — Run executes your edits
Loading...
Console
Output will appear here
Visualization
State
Step through — the console panel shows what's happening
Why?

fetch resolves as soon as headers/status are known — the body might still be streaming in, which is exactly why reading it with .json() is its own separate await.