Build a Leap Year Calculator - Build a Leap Year Calculator

Tell us what’s happening:

All my Trials log the wanted result and i double checked my conditional logic but the test still fails at these two points

  • With 2024 as the value of the year variable, the result should be 2024 is a leap year.
  • With 1900 as the value of the year variable, the result should be 1900 is not a leap year.

i can’t figure out what am i doing wrong? even though the result is correct i think.

Your code so far


function isLeapYear (num) {

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

}

let year = 2024;

const result = isLeapYear(year)

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/143.0.0.0 Safari/537.36

Challenge Information:

Build a Leap Year Calculator - Build a Leap Year Calculator

if you do isLeapYear(1900), what do you expect this line to return?]]

Thank you, i hadn’t noticed i wrote the string wrong, also i realized that i could simplify the code a lot more, thanks for the help