Answer the question
In order to leave comments, you need to log in
What do the fetch() function and the json() method return in total?
Hello.
1) There is the following code, an instance of the Promise is displayed in the console:
function fn() {
const result = fetch('https://jsonplaceholder.typicode.com/users');
console.log(result);
}
fn();
async function fn() {
const result = await fetch('https://jsonplaceholder.typicode.com/users');
console.log(result);
}
fn();
async function fn() {
const result = await fetch('https://jsonplaceholder.typicode.com/users');
return result;
}
console.log(fn());
async function fn() {
const result = await fetch('https://jsonplaceholder.typicode.com/users');
const response = result.json();
console.log(response);
}
fn();
async function fn() {
const result = await fetch('https://jsonplaceholder.typicode.com/users');
const response = await result.json();
console.log(response);
}
fn();
async function fn() {
const result = await fetch('https://jsonplaceholder.typicode.com/users');
const response = await result.json();
return response;
}
console.log(fn());
Answer the question
In order to leave comments, you need to log in
and where do you apply json directly to fetch?
Both fetch and json return a promise.
json you apply to the data that this promise returns when it resolves.
fetch().then(response => response.json()) != fetch().json()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question