fetch(url)
.then((response) => response.json())
.then((responseData) => {
console.log(responseData);
})
let globalResponse;
fetch(url)
.then((response) => {
globalResponse = response;
return response.json();
})
.then((responseData) => {
console.log(responseData, globalResponse);
})
const response = await fetch(url);
const responseData = await response.json();
console.log(responseData, response.headers);
fetch("https://jsonplaceholder.typicode.com/albums")
.then(response => {
console.log(response.headers.get("Content-Type")); // application/json; charset=utf-8
console.log(response.status); // 200
return response.json();
})
.then(res => {
console.log(res); // iliakan
})
.catch(console.log);