Home
<!DOCTYPE html> <html> <body> <h1>Demo: switch statement</h1> <script> var a = 3; switch (a/3) { case 1: alert("case 1 executed"); break; 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: