var i = 1000;
var count = 0;
while(i <= 2000) {
if (i % 2 == 0 && i % 100 !=0 || i % 400 == 0) {
document.write(i, " ");
count++;
if(count % 4 == 0) {
document.write("<br/>");
}
}
i++;
}
JavaScript:打印出1000-2000年的所有闰年,并以每行四个数的形式输出
原文:https://www.cnblogs.com/qjuly/p/13258577.html