Skip to content

Conversation

@Miuroro
Copy link

@Miuroro Miuroro commented Jan 21, 2026

No description provided.

Copy link

@rafaelhdr rafaelhdr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is working great. Congrats 👏

else if ((year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0)) {
console.log(" yes, "+ year + " is a leap year.");

}else if (year % 4 !== 0 || year % 100 === 0) { // added this to know what considered not a leap year

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is working great and it is approved. But this last if is redundant. You could skip the if.

For example:

if (isLeapYear) {
  // do this
} else if (!isLeapYear) {
  // do that
}

The conditional is complementary, and it could be just else

if (isLeapYear) {
  // do this
} else {
  // do that
}

@rafaelhdr rafaelhdr self-assigned this Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants