I am running the following code. Where I am expecting to see the outputs latitude
and longitude
, what I get is Promise{<pending>}
in my console. Why is this the case? I thought using async/await
helps to eliminate the problem of pending promises since the code can't go forward until the promise fulfills. How do I solve this problem?
const issURL = 'someUrl';
async function getData() {
const res = await fetch(issURL);
const data = await res.json();
const {
latitude,
longitude
} = data;
return (latitude, longitude);
}
console.log(getData());