Reputation: 129
when the following is executed the "console.log" it returns nothing in Chrome (Version 60.0.3112.101 ) but a string in Firefox (54.0).
axios.get('https://jsonplaceholder.typicode.com/posts')
.then(function (response) {
console.log(response.data[0].title);
})
.catch(function (error) {
console.log(error);
});
note that if "alert" is used in Chrome instead of "console.log" it works fine. Is there any way to make it work in Chrome?
thanks for any help.
Upvotes: 1
Views: 912
Reputation: 1074385
If I add axios to this page (here on SO), then run that code in Chrome's console, I see this in Chrome:
If you're referring to the undefined
in , [[PromiseValue]]: undefined
, ignore it. That's just the display of the Promise object returned by catch
, which isn't settled yet (thus has no fulfillment value or rejection reason). That has nothing to do with the ultimate settlement of the promise, which as you can see at the bottom of that picture, is the string with the first title.
Upvotes: 2