The switch and with Statements
In this lesson, you will have an overview of all flow-control statements provided by the JavaScript language.
We'll cover the following...
The switch
statement
As an alternative to compound if statements, JavaScript defines the switch statement.
Illustration
Here is the concept explained in the form of an illustration:
Syntax #
The switch
statement has the following syntax:
Press + to interact
switch (expression) {case value1:statementbreak;case value2:statementbreak;// "case" can be repeatedcase valueN:statementbreak;default:statement}
The expression is evaluated, and its value is checked against values in ...
Access this course and 1400+ top-rated courses and projects.