const squad = [];
const firstAstronaut = {
id: 1,
name: “Andy”,
role: “Commander”,
isEVAEligible: true,
};
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);
}const crew = [];
const astronaut = { name: “Sarah”, role: “Commander” };
console.log("Added " + astronaut.name + " as " + astronaut.role);
why does my code fail in step 5? what is mistake did i do here..
error : You should log the astronaut’s name in the following format, Added {astronaut.name} as {astronaut.role}.
tried with template literals as well
please help.