Tell us what’s happening:
hi,what im doing wrong? Push the astronaut object into the crew array and log Added ${astronaut.name} as ${astronaut.role} to the console. You can use either template literals or string concatenation for the log message.
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) {
console.log("Duplicate ID: " + astronaut.id);
return;
}
}
// User Editable Region
crew.push(astronaut);
console.log(`Added ${astronaut.name} as ${astronaut.role}`);
}
// User Editable Region
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36
Challenge Information:
Build a Space Mission Roster - Step 5