Build a Leap Year Calculator - Build a Leap Year Calculator

Tell us what’s happening:

Despite the console.log outputs being correct, the tests still reports wrong or incomplete output.

Your code so far

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


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

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

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



And here are console outputs

// running tests
5. With 2024 as the value of the year variable, the result should be 2024 is a leap year.
6. With 2000 as the value of the year variable, the result should be 2000 is a leap year.
// tests completed
// console output
2024 is a leap year.
2000 is a leap year.
1900 is not a leap year.

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36 Edg/146.0.0.0

Challenge Information:

Build a Leap Year Calculator - Build a Leap Year Calculator

Could you explain what is the number parameter, which is used in a single comparison in the function?

I am sorry, it’s a typo. I forgot to change that parameter. Let me see if it will work.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.