switch
The switch statements compares an expression against a list of case values. Execution jumps to the first case that matches. If nothing matches, execution jumps to the default condition.
var type = NSOA.form.getValue('type');
switch (type) {
case 0:
// statements to handle type 0
break;
case 1:
// statements to handle type 1
break;
case 2:
// statements to handle type 2
break;
default:
// statements to handle all other types
}
Note:
The break statements ends the case and execution jumps to the next statement after the switch block. If the break is omitted execution continues with the next case.