Build a Leap Year Calculator - Build a Leap Year Calculator

Tell us what’s happening:

The test gives me an “error” on 5, 6 and 7 when checking for the specific years. But the console gives me the right response, I even checked with other dates.

Your code so far


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

let year;
let result;

year = 2000;
result = isLeapYear(year);
console.log(result);

year = 2024;
result = isLeapYear(year);
console.log(result);

year = 1900;
result = isLeapYear(year);
console.log(result);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:139.0) Gecko/20100101 Firefox/139.0

Challenge Information:

Build a Leap Year Calculator - Build a Leap Year Calculator

try adding console.log(isLeapYear(1999)) and console.log(isLeapYear(2004)), does it give the message you expect?