I am trying to get response status from an async function after fetching from a url, but I can’t. The responseStatus always 0 in the console log
let responseStatus = 0;
const makeRequest = async () => {
const response = await fetch(url);
responseStatus = response.status;
// console.log(response);
}
makeRequest();
console.log("responseStatus: " + responseStatus)
Expected result:
responseStatus: 200
Actual result:
responseStatus: 0