This is my code:
export function birdsInWeek(birdsPerDay, week) {
let totalBirds = 0;
for (let i = 0; i <= birdsPerDay.length - 1; i++) {
if (week === 1 && i <= 7) {
totalBirds = totalBirds + birdsPerDay[i];
console.log(totalBirds);
} else if (week === 2 && i >= 8 && i <= 14) {
totalBirds = totalBirds + birdsPerDay[i];
} else if (week !== 1 && week !== 2) {
totalBirds = totalBirds + birdsPerDay[i];
}
}
return totalBirds;
}
This is my error:
CODE RUN
const week21 = [2, 0, 1, 4, 1, 3, 0];
const birdsPerDay = randomArray(20 * 7)
.concat(week21)
.concat(randomArray(10 * 7));
expect(birdsInWeek(birdsPerDay, 21)).toBe(11);
TEST FAILURE
Error: expect(received).toBe(expected) // Object.is equality
Expected: 11
Received: 25