Tell us what’s happening:
Can someone help with test ten it says I should store the result of calling the function in a variable called result. Thank you
let year = “”;
function isLeapYear(year) {
if (year % 400 === 0) {
return ${year} is a leap year.;
}
else if (year % 100 === 0) {
return ${year} is not a leap year.;
}
else if (year % 4 === 0) {
return ${year} is a leap year.;
}
else {
return ${year} is not a leap year.;
}
}
const result = isLeapYear();
console.log(result);
Your code so far
let year = "";
function isLeapYear(year) {
if (year % 400 === 0) {
return `${year} is a leap year.`;
}
else if (year % 100 === 0) {
return `${year} is not a leap year.`;
}
else if (year % 4 === 0) {
return `${year} is a leap year.`;
}
else {
return `${year} is not a leap year.`;
}
}
const result = isLeapYear();
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/138.0.0.0 Safari/537.36
Challenge Information:
Build a Leap Year Calculator - Build a Leap Year Calculator
https://www.freecodecamp.org/learn/full-stack-developer/lab-leap-year-calculator/build-a-leap-year-calculator