Hello members!
Am doing this lab but am little confused
When I assign 2024 , 2026 and other years besides what they have given, the console outputs undefined what could be the problem
Your code so far
let year;
year = 2024;
year = 2000;
year = 1900;
year = 2026;
function isLeapYear(year){
if((year % 4 === 0) && (year % 400 === 0))
{
return `${year} is a leap year.`;
}
else if(year % 100 === 0){
return `${year} is not a leap year.`;
}
}
let 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
If the year is divisible by 4, then it is a leap year.
Unless the year is also divisible by 100, then it is not a leap year.
Unless the year is also divisible by 400, then it is a leap year.
this you mean?
“unless” is an exclusion word
it means that if the year is divisible by 4, it is a leap year, but of those divisble by 4, if they are also divisible by 100 then they are not leap years, and of those divisible by 100, they are instead a leap year if they are also divisible by 400