JavaScript Ano bisseiro
function isLeapYear(year){
if(year % 400 === 0 && year % 4 === 0){
return true
} else {
return false
}
}
Glamorous Goose
function isLeapYear(year){
if(year % 400 === 0 && year % 4 === 0){
return true
} else {
return false
}
}
function isLeapYear(year) {
if (year % 400 === 0) return true;
if (year % 100 === 0) return false;
return year % 4 === 0;
}
function isLeapYear(year) {
if (year % 4 == 0) {
console.log("leap year")
} else {
console.log("Not a leap year")
}
}
var myYear = 2020;
isLeapYear(myYear)
// Output:leap year