if yes, why this code doesn’t alert anything?
<html>
<head>
<script type="text/javascript">
switch ("hello world") {
case "hello" + " world":
alert("Greeting was found.");
break;
case "goodbye":
alert("Closing was found.");
break;
default:
alert("Unexpected message was found.");
}
</head>
</html>
Works for me in…
With a switch, you generally compare it to constants. The way you are using it doesn’t make much sense.