Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Asynchronous Programming with JavaScript Understanding Promises From Callbacks to Promises

I'm having a lot of problems with the Promises call.

hi guys! I'm having a lot of problems with promise call, even if I write the same code as the teacher, it seems to be a broken link, I feel me somehow like a stupid person. maybe I'm gut enough to learn how to program.

Steven Parker
Steven Parker
231,248 Points

It might be something as simple as a little typo. Show your code and we can take a look. Even better, make a snapshot of your workspace and post the link to it here.

5 Answers

Steven Parker
Steven Parker
231,248 Points

This one's not your fault. This issue is due to two 3rd-party API's having a disagreement about spelling. :see_no_evil: An improvement would be to display the original name with a message indicating that the profile wasn't found. Code that could automatically resolve this kind of thing in a generic way would be rather complex.

But if you don't mind applying a temporary (and potentially brittle) fix for these specific cases, you could just translate the names as you look up the profiles:

function getProfiles(json) {
  const profiles = json.people.map( person =>
    getJSON(wikiUrl + person.name.replace("Anatoly", "Anatoli")
                                 .replace("Chris", "Christopher"))
  ); 
  return Promise.all(profiles);
}

I appreciated your help. thanks a lot

Hi Alejandro, tnx for your question. I'm getting the same problem. And tnx Steven too for the help :) That's very bad considering that a huge desaster because of such a mere issue of spelling.

Actually, that solution looks pretty good. It only works if you know it's misspelled though. I scratched my head for a while when I was trying to figure it out.