Build a Leap Year Calculator - Build a Leap Year Calculator

Tell us what’s happening:

Good morning
Am sorry for the disturbance but I want to learn and understand.
Please tell me where an error is because all years are leap years and some are outputting undefined

Your code so far

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

function isLeapYear(year){
  if(year % 4 ===0){
    return `${year} is a leap year.`;
  }
  else if(year % 4 === 0 &&year % 100 === 0){
    return `${year} is not a leap year.`;
  }
  else if(year % 100 === 0 && year % 400 === 0)
  return `${year} is a leap year.`;
  
}
const 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

first, if something is divisible by 4 it will go in the first condition and never reach the second

and then, what about the numbers that are not divisible by 4 and not end in 00?

Let me try again

Thanks

I’ve changed the category of your topic to better reflect its content.