Learning JavaScript tutorial – JavaScript switch Statement
JavaScript switch statement control the flow of program execution via a multiway branch. When we need execute a statement block depending on the value of a single variable; JavaScript switch Statement is the best alternative to JavaScript if Condition Statement to it handles the situation more efficiently than repeated if statements.
JavaScript switch Statement Syntax
switch (conditional expression)
{
case condition 1:
statement block executed if condition 1 is true(satisfied).
break;
case condition 2:
statement block executed if condition 1 is true(satisfied).
break;
.
.
.
case condition n:
statement block executed if condition n is true(satisfied).
break;
default:
statement block executed if no condition is true(satisfied).
break;
}





