I am going through a javascript tutorial, and I need some help in understanding the pattern in the following function:
get: function(url) {
return fetch(rootUrl + url, {
headers: {
'Authorization': 'Client-ID ' + apiKey
}
} )
.then(
function(response) {
return response.json();
}
);
}
What I am confused about is, what is the point of returning fetch() if we only actually care about response.json()?