1 var year = +prompt("请用户输入年份"); 2 var year1 = +prompt("请用户输入月份"); 3 if (year1 == 1, 3, 5, 7, 8, 10, 12) { 4 alert("有31天"); 5 } else if (year1 == 4, 6, 9, 11) { 6 alert("这个月有28天") 7 } else if (year1 == 2) { 8 alert("是平年就28天"); 9 } else { 10 alert("是闰年就29天"); 11 }
原文:https://www.cnblogs.com/zycs/p/12158333.html