switch(month){
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
console.log(month+"月有31天");
break;
case 4:
case 6:
case 9:
case 11:
console.log(month+"月有30天");
break;
default:
console.log(month+"月有28天");
}
switch(month){
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
console.log(month+"月有31天");
break;
case 4:
case 6:
case 9:
case 11:
console.log(month+"月有30天");
break;
default:
console.log(month+"月有28天");
}
本文标题:switch分支语句合并相同功能的case语句
本文链接:https://www.haomeiwen.com/subject/pusbhltx.html
网友评论