I have the following:
switch(state) {
case MyStates.StateA:
//do something
break;
case MyStates.StateB:
//do something
break;
case MyStates.StateC:
//do something
break;
}
Say StateB and StateC both need to process the same bit of code, how can I avoid the duplication? Note that I cannot set MyStates.StateB = MyStates.StateC; they have to differ and can also be of different types. I want to do something like the following illegal statement:
case MyStates.StateB || case MyStates.StateC :
breakkeyword is used to stop fall-through. javascript.about.com/od/hintsandtips/a/fallthrough.htm