check if leap year javascript code example
Example 1: javascript leap year
function isLeapYear(year){
if(year % 400 === 0 && year % 4 === 0){
return true
} else {
return false
}
}
Example 2: find leap year javascript
function isLeap(year) {
if (year % 4 === 0) {
if (year % 100 === 0){
if (year % 400 == 0){
return ("Leap year.");
} else {
return ("Not leap year.");
}
} else {
return ("Leap year.");
}
} else{
return ("Not leap year.");
}
}