JavaScript:打印出1000-2000年的所有闰年,并以每行四个数的形式输出

var i = 1000;
var count = 0;
while(i <= 2000) {
  if (i % 2 == 0 && i % 100 !=0 || i % 400 == 0) {
      document.write(i, "&nbsp");
      count++;
      if(count % 4 == 0) {
        document.write("<br/>");
      }   
  }
  i++;
}

原文地址:https://www.cnblogs.com/qjuly/p/13258577.html