JavaScript

Thom Benjamin
Thom Benjamin
10,492 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;
  });
}