You can use the switch statement to select a particular group of statements to be executed among several other groups of a statement.
Demo
Let’s create a document called switchStatement.html:



Explanation
letter” is the expression of switch statement. The value of the letter variable is compared with the case values one by one. When a match is found, which in this case is the third case statement, the set of statements specified in the case is executed.
Thank you for reading this blog.
Join the conversation! Your thoughts help the community grow.