← JavaScript for Real
Lesson 6 · zap JavaScript for Real
Fetch & JSON
Call an HTTP API correctly, including the failure paths.
Before you start
fetch only rejects on network failure — a 500 response is a *successful* fetch with ok: false. Forgetting that is the single most common bug in first-time API code, and it's why every serious client wraps fetch.
5 exercises·up to 87 XP·5/5 hearts