Build a Leap Year Calculator - Build a Leap Year Calculator

Tell us what’s happening:

The only issue I have is that my "const result = isLeapYear(year); comes back as result is not a function. The function works properly, I know this because when I take away “(year)” from the result, I get the correct answers, but once I put it back in, all of the tests fail again.

Your code so far

let year = 0;

function isLeapYear(year) {
  if(year % 4 == 0 && year % 400 == 0) {
    return `${year} is a leap year.`;
  } else if(year % 4 == 0 && year % 100 !== 0) {
    return `${year} is a leap year.`;
  } else if(year % 4 == 0 && year % 100 == 0) {
    return `${year} is not a leap year.`;
  } else {
    return `${year} is not a leap year`;
  }
}

year = 2024
const result = isLeapYear(year);

console.log(result(2000))

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36

Challenge Information:

Build a Leap Year Calculator - Build a Leap Year Calculator

I figured it out. If you make the result = the function you can’t input a different year into the console.log, you have to change the year independently and then just log the result. At least that’s what worked for me. If I’m wrong please let me know and thank you either way!

you are trying to call result as a function, but it’s a string, because that’s what isLeapYear returns. Instead you want to write console.log(isLeapYear(2000))