Build a Leap Year Calculator - Build a Leap Year Calculator

Tell us what’s happening:

I receive errors for 2 of the 3 tests 5 through 7, despite obtaining the correct result when testing each year individually. I always fail the 2 tests that I have not set my year variable to. I have also tried declaring the year and result variables using let, and logging 3 results, but when i do this, I always pass the test for the last year in my code, but fail the 1st two, despite correct results displaying in the console.

Your code so far


const isLeapYear = testYear => {
  if (testYear % 4 === 0 & (testYear % 100 > 0 || testYear % 400 === 0)) {
    return `${year} is a leap year.`;
  }   else {
    return `${year} is not a leap year.`;
  }
}

const year = 2024; 
const result = isLeapYear(year);
console.log(result);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36

Challenge Information:

Build a Leap Year Calculator - Build a Leap Year Calculator

double check if you are always using the function parameter

oof! thank you for that hint, and quick reply.