Build a Space Mission Roster - Step 8

Tell us what’s happening:

Hello,
The instructions say to remove the console.log() from the addCrewMember function, which I already did. However, the tests are still failing.
Could you help me identify what might be wrong?

"// running tests

  1. Remove the console.log() call from your addCrewMember function. You should delete the entire line.
    // tests completed"

Your code so far

const squad = [];

const firstAstronaut = {
  id: 1,
  name: "Andy",
  role: "Commander",
  isEVAEligible: true,
  priority: 3
};
function addCrewMember(crew, astronaut) {
  for (let i = 0; i < crew.length; i++) {
    if (crew[i].id === astronaut.id) {
      return;
    }
  }
  crew.push(astronaut);
}
addCrewMember(squad, firstAstronaut);

const remainingCrew = [
  { id: 2, name: "Bart", role: "Pilot", isEVAEligible: false, priority: 8 },
  { id: 3, name: "Caroline", role: "Engineer", isEVAEligible: true, priority: 4 },
  { id: 4, name: "Diego", role: "Scientist", isEVAEligible: false, priority: 1 },
  { id: 5, name: "Elise", role: "Medic", isEVAEligible: true, priority: 7 },
  { id: 6, name: "Felix", role: "Navigator", isEVAEligible: true, priority: 6 },
  { id: 7, name: "Gertrude", role: "Communications", isEVAEligible: false, priority: 4 },
  { id: 8, name: "Hank", role: "Mechanic", isEVAEligible: true, priority: 2 },
  { id: 9, name: "Irene", role: "Specialist", isEVAEligible: true, priority: 5 },
  { id: 10, name: "Joan", role: "Technician", isEVAEligible: false, priority: 1 },
]; 

for (let i = 0; i < remainingCrew.length; i++) {
  addCrewMember(squad, remainingCrew[i]);
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:151.0) Gecko/20100101 Firefox/151.0

Challenge Information:

Build a Space Mission Roster - Step 8

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/workshop-space-mission-roster/6951cfd4955dbb84cb9b8b22.md at main · freeCodeCamp/freeCodeCamp · GitHub

Welcome to the forum @marianyarj,

Here’s the starting code for this step:

function addCrewMember(crew, astronaut) {
  for (let i = 0; i < crew.length; i++) {
    if (crew[i].id === astronaut.id) {
      console.log("Duplicate ID: " + astronaut.id);
      return;
    }
  }
  crew.push(astronaut);
console.log(`Added ${astronaut.name} as ${astronaut.role}`);
}

Just remove the last console.log() call to pass the tests.

You may want to reset this step and try again.

Happy coding