Fetch API Return Type
Multiple Choice Medium
Question
What does the fetch() API return?
Hint
fetch is asynchronous, so it returns a Promise.
Explanation
fetch() returns a Promise that resolves to a Response object. You need to call response.json() (which also returns a Promise) to get the data. The pattern is: fetch(url).then(res => res.json()).then(data => console.log(data)). Error handling uses .catch() or try/await/catch.
Related Resources
Related Lessons
- Fetch API
Learn the Fetch API.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.