@helmus's answer is correct and is a good solution.
However, you can maintain the NaN
case if you use strings:
switch(x+''){
case "1":
case "2":
case "4":
doSomething();
break;
case "NaN":
doSomethingElse();
break;
default:
doADifferentThing();
break;
}