Javascript Switch Statement

tutorial and example
tutorial and example

The switch statement is used in JavaScript to execute one code in multiple conditions. It is same as else if statement but it is more convenient then repeated if..else..if statement.

Syntax

NOTE: Break statement plays a dominant role in switch-case statements.

Example

Try Now

Output