var month = 7;
var year  = new Date().getFullYear();
switch(month) {
   case 1:
   case 3:
   case 5:
   case 7:
   case 8:
   case 10:
   case 12:
      alert(`${year}年${month}月有31天`);
      break;
   case 2:
      var year = new Date().getFullYear();
      if (year % 2 == 0 && year % 100 != 0 || year % 400 == 0) {
          alert(`${year}年${month}月29天`);    
      } else {
          alert(`${year}年${month}月28天`);
      }
      break;
   default:
      alert(`${year}年${month}月30天`);
      break;
}


相关文章:

  • 2021-07-04
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
  • 2021-07-31
  • 2021-07-19
  • 2022-02-05
  • 2021-09-22
猜你喜欢
  • 2022-12-23
  • 2021-06-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案