fetch GET
fetch returns a Promise that fulfills with a Response — not the JSON yet.
fetch(url) sends an HTTP request (default method GET).
When the network round-trip finishes, the promise fulfills with a
Response object. Inspect status,
ok, and headers before reading the body (next lesson).
Needs network access.
Response metadata appears here.
Important JavaScript
const response = await fetch(
"https://jsonplaceholder.typicode.com/posts/1"
);
console.log(response.status); // e.g. 200
console.log(response.ok); // true for 200–299
// Body not read yet — use response.json() next