Fetch API & Handling JSON Responses

Why is checking response.ok important?
const response = await fetch('/api/data');
if (!response.ok) {
  throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
Next Question (4/21)