I don’t understand why I am not getting it.
I get that there is an error in my logic but I am struggling top identify what it is
Your code so far
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)
year = 2000
result = isLeapYear(year);
console.log(result)
year = 1900
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/145.0.0.0 Safari/537.36 Edg/145.0.0.0
Challenge Information:
Build a Leap Year Calculator - Build a Leap Year Calculator
I want to go just a bit further because it is understandable to want to put all of the conditions together because they are all in the same sentence. But, as Teller suggested, break down the logic bit by bit and examine.
Also, @Teller, this is worth reporting, but the logic steps do not make sense in the steps of the story, but they are correct in the initial opening paragraph.
i.e. this is incorrect because a user will naturally follow the flow of the logic since they are separated into different bullet points.