I'm having trouble understanding why my values that I've retrieve from the API, is not being stored in this.schedule. When I console.log my result from my call, I see the returned Promise. My assumption is that when I use .then, I am storing the value into the variable schedule. What am I overlooking?
var getData = function(url, teamId) {
var object = {
"schedule": [],
"record": null,
"nextSixGames": [],
"url": url
};
this.url = url
var schedule = utils.teamSchedule(url, teamId).then(function(result) {
return result
});
this.schedule = schedule;
return object;
}
getData(URL, teamID)
console.log(getData(URL, teamID))