Content Menu

Home-What is JavaScript?

JavaScript tutorials

1. JavaScript Basics

2. JS Simple Coding

3. JS InterActive Content

4. Images and JS

5. JS Functions

6. JavaScript Events

7. JS Conditional

8. JS Loops

9. Other

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.