Command Palette

Search for a command to run...

Hectal
Phase 11: Network and Browser APIs
JavaScript · Exercise 1 of 5Next
Beginner

Fetch a user and show it

USER_URL is a data: URL that answers like a real API with {"name":"Asha Rao","city":"Pune"}.

Fetch it, check res.ok, read the JSON, and put the name in #name and the city in #city.

What Check tests

  1. #name shows Asha Rao
  2. #city shows Pune
  3. The data comes from fetch, not typed in
  4. The code checks res.ok
  5. No errors

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.