If asynchronous functions execute after the main thread, then why does k
, printed to the console, have [[PromiseStatus]]: "fulfilled".
Surely a promise can only be fulfilled
when it's successfully completed its asynchronous behaviour. Shouldn't it be 'pending' or something? It does say pending somewhere if you look at the picture.
function fetchDog(){
k = fetch("https://dog.ceo/api/breeds/image/random")
console.log(k);
};
fetchDog();