Javascript examples for Statement:switch
Switch on string value
<html> <head> <script type="text/javascript"> var color; color = "red"; switch (color){ case"red"://from w ww .ja v a 2 s . co m console.log("RED"); break; case "white": console.log("WHITE"); break; case "blue": console.log("BLUE"); break; default: console.log("default"); } </script> </head> <body> </body> </html>