Build a Leap Year Calculator - Build a Leap Year Calculator

Tell us what’s happening:

Hello members!
Am doing this lab but am little confused
When I assign 2024 , 2026 and other years besides what they have given, the console outputs undefined what could be the problem

Your code so far

let year;
year = 2024;
year = 2000;
year = 1900;
year = 2026;

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

}

let result = isLeapYear(year);
console.log(result);

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Mobile Safari/537.36

Challenge Information:

Build a Leap Year Calculator - Build a Leap Year Calculator

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-leap-year-calculator/66c06fad3475cd92421b9ac2.md at main · freeCodeCamp/freeCodeCamp · GitHub

with these conditions you are only outputtung something for years that end in 00 and no others

I have tried again and others years are passing but now 1900 is not passing

I think am confused with the word unless in the sentence please help me explain to me what it means

  • If the year is divisible by 4, then it is a leap year.
  • Unless the year is also divisible by 100, then it is not a leap year.
  • Unless the year is also divisible by 400, then it is a leap year.

this you mean?

“unless” is an exclusion word
it means that if the year is divisible by 4, it is a leap year, but of those divisble by 4, if they are also divisible by 100 then they are not leap years, and of those divisible by 100, they are instead a leap year if they are also divisible by 400

Thank you

Now I understand i will redo my test