Switch statement multiple cases in JavaScript

Posted by Pinki | Updated on

In this example, I have shared switch statement multiple cases in JavaScript. Use the fall-through feature of the switch statement. A matched case will run until a break (or the end of the switch statement) is found, so you could write it like:

Multiple Criteria in a Single Case inside a Switch Statement
There is one hacky switch style that allows you to specify ranges:

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers