JavaScript Switch Fall-Through

01.05.2015

There are a couple of interesting things about the JavaScript Switch statement.

It allows fall-through and hierarchical code execution.

You must use the break keyword to exit and stop the fall-through.

If multiple cases take the same action, you can use fall-through to minimize duplication.

You can have a “default” case.

Fall-through allows hierarchical code execution: least common properties first, and most common last.

Sources

https://www.codeschool.com/courses/javascript-best-practices