ugh, fetch() is a pain sometimes. One thing that got me: you gotta chain .then() properly or it won’t work.
Also, if the API is down, your code *will* crash unless you handle errors. Wrap it in try/catch if using async/await:
```javascript
try {
const response = await fetch('your-api-url');
const data = await response.json();
console.log(data);
} catch (err) {
console.log('RIP API', err);
}
```
Check out the MDN docs on rest api request javascript—super helpful!
Also, if the API is down, your code *will* crash unless you handle errors. Wrap it in try/catch if using async/await:
```javascript
try {
const response = await fetch('your-api-url');
const data = await response.json();
console.log(data);
} catch (err) {
console.log('RIP API', err);
}
```
Check out the MDN docs on rest api request javascript—super helpful!
