Predict Fetch Response
Predict Output Medium
Question
What does the fetch() function return?
Code
const result = fetch("https://api.example.com/data");
console.log(typeof result);
Hint
It returns something you can call .then() on.
Explanation
fetch() returns a Promise object. typeof result is 'object' because a Promise is an object. To get the actual response data, you need to await the promise (or use .then()), then call response.json() or response.text() to parse the body.
Related Resources
Related Lessons
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.