Tell us what’s happening:
Good morning
Am sorry for the disturbance but I want to learn and understand.
Please tell me where an error is because all years are leap years and some are outputting undefined
Your code so far
let year;
year = 2024;
year = 2000;
year = 1900;
function isLeapYear(year){
if(year % 4 ===0){
return `${year} is a leap year.`;
}
else if(year % 4 === 0 &&year % 100 === 0){
return `${year} is not a leap year.`;
}
else if(year % 100 === 0 && year % 400 === 0)
return `${year} is a leap year.`;
}
const result = isLeapYear(year);
console.log(result);
Your browser information:
User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Mobile Safari/537.36
Challenge Information:
Build a Leap Year Calculator - Build a Leap Year Calculator