Is Leap Year

Determines if a given year is a leap year.

Contributed by @itsbrunodev

javascript
function isLeapYear(year) {
  if (year % 4 !== 0) return false;
  if (year % 100 === 0 && year % 400 !== 0) return false;
  return true;
}
javascript
isLeapYear(2024); // true
isLeapYear(2023); // false
GitHubEdit on GitHub