I am not sure what I am missing. I am able to print the list to the console as requested. But the test keeps giving the following error:
You should use a nested for loop to iterate through EVAChunks and log the name of every astronaut in each chunk. Log Chunk ${i+1}: between chunks.
You should use a nested for loop to iterate through EVAChunks and log the name of every astronaut in each chunk. Log Chunk ${i+1}: between chunks.
function chunkCrew(crew, size) {
if (size < 1) {
console.log("Chunk size must be >= 1");
return;
}
const chunks = [];
for (let i = 0; i < crew.length; i += size) {
chunks.push(crew.slice(i, i + size));
}
return chunks;
}
const EVAChunks = chunkCrew(EVAReadySquad, 3);
console.log(EVAChunks);
for(let i = 0; i < EVAChunks.length; i++) {
console.log(`Chunk ${i + 1}:`);
for (let j = 0; j < EVAChunks[i].length; j++) {
console.log(EVAChunks[i][j].name);
}
}
Lesson URL (Build a Space Mission Roster - Step 26)