Mega Code Archive

 
Categories / JavaScript Tutorial / Statement
 

Switch with boolean value

< html> <head> <title>A Simple Page</title> <script language="JavaScript"> <!-- var yourchoice; yourchoice = confirm("Are you at your computer now?") switch (yourchoice) {     case true:         alert("true");         break;     case false:         alert("false");         break; } //  --> </script> </head> <body> </body> </html>