Tell us what’s happening:
I dont really know whats going on here. If i manually substitute any value to the year variable, it works properly. I have to manually put “2000” or “1900” or “2024” as values for the year variable to fulfill the user stories. I obviously cant put all 3 together. I don’t really know whats wrong here.
Your code so far
const year = 2000;
function isLeapYear (number) {
if (number % 4 == 0 && number % 400 == 0) {
return `${year} is a leap year.`
} else if (number % 4 == 0 && number % 100 != 0) {
return `${year} is a leap year.`
} else if (number % 4 == 0 && number % 100 == 0 && number % 400 != 0) {
return `${year} is not a leap year.`
} else if (number % 4 != 0) {
return `${year} is not a leap year.`
}
}
const 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/137.0.0.0 Safari/537.36
Challenge Information:
Build a Leap Year Calculator - Build a Leap Year Calculator