Javascript examples for Statement:switch
Use Case label in switch statement
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){// w w w .j ava 2 s.c o m var a = 1; switch (a) { case 0: // do stuff break; case 1: case 2: console.log(a); // alerts "1" break; default: // do default stuff break; } } </script> </head> <body> </body> </html>