Use switch statement with true false value in JavaScript
Description
The following code shows how to use switch statement with true false value.
Example
<!DOCTYPE html>
<html>
<head>
<script language="JavaScript">
var yourchoice = true;<!-- ww w . j a v a 2s . c om-->
switch (yourchoice)
{
case true:
alert("true!");
break;
case false:
alert("false");
break;
}
</script>
</head>
<body>
</body>
</html>
The code above generates the following result.
Javascript Tutorial Switch
Use Switch statement on day of week value r...
Use switch statement inside a for loop in J...
Use switch statement with string value in J...
Use Switch statement on day of week value r...
Use switch statement inside a for loop in J...
Use switch statement with string value in J...