Categories
Determines if a given year is a leap year.
Contributed by @itsbrunodev
function isLeapYear(year) { if (year % 4 !== 0) return false; if (year % 100 === 0 && year % 400 !== 0) return false; return true; }
isLeapYear(2024); // true isLeapYear(2023); // false