This is unexpected for me, but this seems to be some issue with async-await itself. I am using node v8.0
For the code below:
(async function(){
var userProfile = await (myApiHelper.getUserProfile(userName));
console.log(userProfile);
console.log(userProfile.location);
}());
In above code,
console.log(userProfile)
, prints the correct data:
{"name": "abc", "location": "Bangalore"};
But
console.log(userProfile.location)
prints undefined.
Can anyone please help me here, if I am doing anything wrong.
via undefined
No comments:
Post a Comment