📜  闰年javascript代码示例

📅  最后修改于: 2022-03-11 15:01:18.506000             🧑  作者: Mango

代码示例4
var leapYear = prompt('Please enter year to check if it is a leap year :');

if ((leapYear % 4 === 0 && leapYear % 100 !== 0) || leapYear % 400 === 0) {
    alert(`${leapYear} : is a leap year`);
} else {
    alert(`${leapYear} : is not a leap year`);
}