DEV Community

Cover image for JavaScript Program to Check Leap Year
Shaha Reja
Shaha Reja

Posted on

JavaScript Program to Check Leap Year

function isLeapYear(year) {
if (year % 400 === 0) return true;
if (year % 100 === 0) return false;
return year % 4 === 0;
}
const isThatLeapYear = isLeapYear(2000);
if (isThatLeapYear == true) {
console.log("Thi is is leap Year");
} else console.log("This is not Leap Year");

Top comments (0)