Promises not resolving?

Hi,
I’m new to Javascript and when I try to call an API with fetch, I always get an unresolved promises in the console. This is the code in question.

async function showAppleStockPriceAsync() {
    let url = 'http://dev.markitondemand.com/Api/v2/Quote/json?symbol=AAPL';
    let response = await fetch(url);
    let body = await response.json();
    await console.log(body.Symbol)
}

componentDidMount() {
       showAppleStockPriceAsync();
    }

Whenever I run this, I get:

Promise {
1"_40": 0,
"_55": null,
"_65": 0,
"_72": null,
}
Promise {
"_40": 0,
"_55": null,
"_65": 0,
"_72": null,
}
AAPL

I’m getting the correct output, but where do the weird promise messages occur from?

Thanks.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.