Home
<!DOCTYPE html> <html> <body> <h1>Demo: switch case</h1> <script> var a = 3; switch (a) { case 1: alert('case 1 executed'); case 2: alert("case 2 executed"); break; case 3: alert("case 3 executed"); break; case 4: alert("case 4 executed"); break; default: alert("default case executed"); } </script> </body> </html>
Result: