Chapter 8 — fetch() and APIs

New concepts: fetch, async/await, Promise, JSON, error handling

Open the browser Console (F12 → Console) to see output from console.log().

Exercises

  1. fetch('data/sales.json') and render the first 10 orders in a table
  2. Add error handling with try/catch — test with a wrong URL
  3. fetch employees.json and products.json in parallel with Promise.all()
  4. Build a loading spinner shown while fetch is running, hidden on complete