Switch Statement of JavaScript

Switch Statement Definition:

The basic syntax of the switch statement is to give an expression to evaluate and several different statements to execute based on the value of the expression.

The interpreter checks each case against the value of the expression until a match is found, If nothing matches, a default condition will be used.

The switch case statement has an expression which is compared with values of each case statement and if a match is found, the associated code is executed.


Example :


School: aimtocode.com
Std Name: Prayag
Result: Distinction

Read Also