Switch Statements in JavaScript | kirupa.com

by kirupa | 6 January 2013

In a world filled with beautiful if, else, and else if statements, the need for yet another way of dealing with conditionals may seem unnecessary. People with longer beards than you and me disagreed, so we have what are known as switch statements. In this short tutorial, I will describe how to use switch statements and why, putting my initial snarkastic comments aside, they can provide some value.


This is a companion discussion topic for the original entry at http://www.kirupa.com/html5/switch_statements_javascript.htm