I need multiple cases in switch statement in JavaScript, Something like:(我需要在JavaScript的switch语句中使用多种情况,例如:)
switch (varName)
{
case "afshin", "saeed", "larry":
alert('Hey');
break;
default:
alert('Default case');
break;
}
How can I do that?(我怎样才能做到这一点?) If there's no way to do something like that in JavaScript, I want to know an alternative solution that also follows DRY concept .(如果没有办法在JavaScript中执行类似的操作,我想知道一个也遵循DRY概念的替代解决方案。)
ask by Afshin Mehrabani translate from so