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

Thom Benjamin
Thom Benjamin
10,494 Points

How to change the astronaut project to get it to work again?

In the Asynchronous JavaScript course we made a website where we fetch data to display all the people that are in space. After we got the names we get some extra information from the Wikipedia page by concatenating their name to a Wiki link.

There are a few cases where there are multiple Wiki pages with the same name, so it doesn't return the person anymore, without adding (cosmonaut) to the link. How can I check if there's multiple people on Wiki with the name I'm iterating over? I think it has to be done in this piece of the code:

function getProfiles(astrosJSON) {
  astrosJSON.people.map( person => {
    profile = getJSON(wikiUrl + person.name, generateHTML);
    return profile;
  });
}