Tell us what’s happening:
My code does not pass the last tests. It says with 2000 selected, the output should say 2000 is a leap which when I change the year variable it says the result for 2024 is wrong but when I change the year to 2024 it goes back to saying 2000 answer is wrong even though it is correct
Your code so far
function isLeapYear(number) {
if (number % 4 == 0) {
if (number % 100 == 0 && number % 400 != 0) {
return `${year} is not a leap year.`;
}
else {
return `${year} is a leap year.`;
}
}
else {
return `${year} is not a leap year.`;
}
}
let year = 1986;
let 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/134.0.0.0 Safari/537.36
Challenge Information:
Build a Leap Year Calculator - Build a Leap Year Calculator