JS中的闰年判断

    var year = 2016;
    if (year % 4 == 0 && year % 100 !== 0 || year % 400 == 0) {
        console.log("今年是闰年!");
    } else {
        console.log("今年是平年!");
    }

 

posted @ 2019-03-10 16:42  showTimehzy  阅读(2280)  评论(0)    收藏  举报