JavaScript Asynchronous Programming with JavaScript Understanding Promises From Callbacks to Promises

Farid Lavizadeh
Farid Lavizadeh
11,611 Points

What is getJSON in getProfile returning to?

In the bellow function, there are 2 returns. I understand the "return profiles". I don't understand why there is an inner return for getJSON function. Where is it being passed to? And why wasn't it there before when the entire function was just a call back? (again I am referring to only to the first return. Does resolve(data) not return data?

function getProfiles(json) {
       const profiles = person => {
       return getJSON(wikiUrl +;
  return profiles;

Mod Edit: Fixed code formatting. See the Treehouse Markdown Guide for more information on how to do this.