Build a Leap Year Calculator - Build a Leap Year Calculator

Tell us what’s happening:

I got the exact given value when I logged the variable to the console, don’t know why I’m still getting an error message.

Your code so far

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

let year = 2024; 
let 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/146.0.0.0 Safari/537.36

Challenge Information:

Build a Leap Year Calculator - Build a Leap Year Calculator

Hi @gideonosag ,

What does your first failing test say?

Happy coding!

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

That is not the first failing test; it is the second failing test. What does the first one say? In fact, I’m seeing the same message in the hint.

removed by moderator

I’ve now added the year parameter, I omitted that while making this post. Still the same issue

Please post your updated code.

function isLeapYear(year) {

if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0){

  return \`${year} is a leap year\`

}else{

  return \`${year} is not a leap year\`

}

}

let year = 2024; 

let result = isLeapYear(year);

console.log(result);

I’ve edited your post to improve the readability of the code. When you enter a code block into a forum post, please precede it with three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add the backticks.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

1 Like

Please check the messages you are returning. Do they match exactly to the instructions?

1 Like

oh my.

Thank you very much, omitted dots