Pages

Monday, 23 April 2012

JavaScript Switch


It performs the same function as the else if statement in the last lesson. It basically deals with multiple scenarios and tests various conditions.
A condition in a switch statement is refered to as a CASE. If case is true-execute a block of code, if it is False see if any other case is true. If any other case is true, execute a block of code, repeat the process until find a true case / condition.
If none of the cases mentioned are true, will tell the browser what to do by using simply DEFAULT. default performs the same function as else.

No comments:

Post a Comment

Thank you for your valuable comment