# Stuck on the bird watcher exercise

I don’t know what’s wrong with my code, I attempt everything and couldn’t pass

``````// @ts-check
//
// The line above enables type checking for this file. Various IDEs interpret
// the @ts-check directive. It will give you helpful autocompletion when
// implementing this exercise.

/**
* Calculates the total bird count.
*
* @param {number[]} birdsPerDay
* @returns {number} total bird count
*/
export function totalBirdCount(birdsPerDay) {
//starts with 0
let count = 0;
for (let i = 0; i < birdsPerDay.length; i++) {
count += birdsPerDay[i]; //adds the number of birds per day to the count
}
return count; //-> return of the function
}
/**
* Calculates the total number of birds seen in a specific week.
*
* @param {number[]} birdsPerDay
* @param {number} week
* @returns {number} birds counted in the given week
*/

export function birdsInWeek(birdsPerDay, week) {
let sum = 0;
//the same as the totalBirdCount function, but only for a specific week
for (let i = 7 * (week - 1); i < 7 * week; i++) { // the week have 7 days, so we need to multiply the week number by 7 and -1 to get the first day of the week
sum += birdsPerDay[i];
}
return sum;
}

/**
* Fixes the counting mistake by increasing the bird count
* by one for every second day.
*
* @param {number[]} birdsPerDay
* @returns {number[]} corrected bird count data
*/
export function fixBirdCountLog(birdsPerDay) {
// inicialize an empty array to store the correct data
let everyTwoDays = [];
//then Loop through the array and add 1 to every second day
for (let i = 0; i < birdsPerDay.length; i++) {
//if the index of the element is an odd number, increment by one
if (i % 2 !== 0) {
everyTwoDays.push(birdsPerDay[i] + 1);
}
//else just push the element to the new array
else {
everyTwoDays.push(birdsPerDay[i]);

return everyTwoDays;
}
}
}
``````

What happens when you run the tests? Is there an error message?

``````SyntaxError: <solution>/bird-watcher.js: Identifier 'totalBirdCount' has already been declared. (61:16)

59 | }
60 |
> 61 | export function totalBirdCount(birdsPerDay) {
|                 ^
62 |   let count = 0;
63 |   for (let i = 0; i < birdsPerDay.length; i++) {
64 |     console.log(`Adding \${birdsPerDay[i]} to \${count}`);
``````

it’s really hard to know what’s happening :(

This suggests you’re defining the function on line 61. The code you shared shows the function defined on line 13.