Previous
If Condition 
Next
For Loop 
ABC of JavaScript : An Interactive JavaScript Tutorial
Switch Case

Switch Case

Syntax:
switch (VARIABLE) {
case CONDITION : STATEMENT
break
case CONDITION : STATEMENT
break
case CONDITION : STATEMENT
break
default : STATEMENT
}

This has a similar function as the If condition - but it is more useful in situations when there is many possible values for the variable. Switch will evaluate one of several statements, depending on the value of a given variable. If no given value matches the variable, the default statement is executed.

Previous
If Condition 
Next
For Loop 
blog comments powered by Disqus