Build a Leap Year Calculator - Build a Leap Year Calculator

Tell us what’s happening:

Hi everyone, can I get some help please?

I am failing whichever tests I do not set the year as. So if I set the year var to 2000 then that passes whilst the other two fail. Individually, every test passes.
Am I meant to declare and iterate across each year?

Your code so far

function isLeapYear (num) {
  let remainder = num % 4
  if (num % 100 == 0 && num % 400 != 0) {
    remainder =+ 1
  }

  if (remainder != 0) {
    return `${year} is not a leap year.`
  } else {
    return `${year} is a leap year.`
  }
}
var year = 1900
var 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/150.0.0.0 Safari/537.36 Edg/150.0.0.0

Challenge Information:

Build a Leap Year Calculator - Build a Leap Year Calculator

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-leap-year-calculator/66c06fad3475cd92421b9ac2.md at main · freeCodeCamp/freeCodeCamp · GitHub

I have simplified my approach but am still seeing the same issue.

Welcome to the forum @dexterdainton!

According to the var keyword: Please read this theory page.

The user stories doesn´t tell you, but for the tests you need to pass year
as an argument and not num.

Why did you wrote the function call for the result in parentheses?

Those are rather syntaxial errors, your logic is working and this matters the most.

Thank you so much for that. Changing num to year indeed allowed me to pass the test.

I hadn’t noticed I had wrapped the function call in an addition set of parentheses. There was no reason for that. :grinning_face_with_smiling_eyes: