其他分享
首页 > 其他分享> > 利用函数判断闰年

利用函数判断闰年

作者:互联网

 

 

 

  <script>
    function run(year) {
      let a = false;
      if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
        a = true;
      }
      return a;
    }
    console.log(run(2000));
    console.log(run(2021));
  </script>

 

标签:function,判断,console,函数,闰年,400,year,run,log
来源: https://www.cnblogs.com/0722tian/p/16138570.html