Build a Leap Year Calculator - Build a Leap Year Calculator

Tell us what’s happening:

Can someone give me advice, I am not passing most of the criteria. I believe its right, but I am clearly missing a small detail

Your code so far

function isLeapYear(year) 
{
   if (year % 400 == 0) {
      return year + " is a leap year.";
  } 
  else if (year % 100 == 0) {
      return year + " is not a leap year.";
  }
  else if (year % 4 == 0) {
    return year + " is a leap year.";
  }
  else {
    return year + " is not a leap year.";
  }
  
}
let year = 2024;
result = isLeapYear(2024);
console.log(result);

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

year = 1900;
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/144.0.0.0 Safari/537.36

Challenge Information:

Build a Leap Year Calculator - Build a Leap Year Calculator

hello @Matti welcome to the forum! You need to properly declare your variable here.

Thank you! solved now!!!

1 Like