使用
switch语句的直通功能。匹配的大小写将一直运行到找到
break(或
switch语句的末尾)为止,因此您可以这样写:
switch (varName){ case "afshin": case "saeed": case "larry": alert('Hey'); break; default: alert('Default case');}
使用
switch语句的直通功能。匹配的大小写将一直运行到找到
break(或
switch语句的末尾)为止,因此您可以这样写:
switch (varName){ case "afshin": case "saeed": case "larry": alert('Hey'); break; default: alert('Default case');}