Tell us what’s happening:
If I run this code, I cannot fulfil this step. “Failed: 7. With 1900 as the value of the year variable, the result should be 1900 is not a leap year…”
and I try changing the value of the “let year” variable to this: “let year = 1900;” After that I ran the code again, and now I haven’t not fullfil these two steps “Failed:5. With 2024 as the value of the year variable, the result should be 2024 is a leap year…” "Failed: 6. With 2000 as the value of the year variable, the result should be."2000
Your code so far
function isLeapYear(yearNum){
if(year%4==0){
if(year%400==0){
return `${yearNum} is a leap year.`;
}else if(year%100==0){
return `${yearNum} is not a leap year.`;
}else{
return `${yearNum} is a leap year.`;
}
}else{
return `${yearNum} is not a leap year.`;
}
}
let year = 2000;
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/132.0.0.0 Safari/537.36
Challenge Information:
Build a Leap Year Calculator - Build a Leap Year Calculator