SWITCH
BLOCK᠁…BREAK᠁ Empty stat… \n
ecma5… my marks…[^2]
switch (expr) {
case "Oranges":
alert("Oranges");
break;
case "Apples":
alert("Apples");
break;
case "Bananas":
alert("Bananas");
break;
case "Cherries":
alert("Cherries");
break;
case "Mangoes":
case "Papayas":
alert("Mangoes and papayas");
break;
default:
alert(`Sorry,NOT Sorry,`);
}
alert("Is there anything else you'd like?");
switch (expr) {
case "Oranges":
alert("Oranges"); break;
case "Apples":
alert("Apples"); break;
case "Bananas":
alert("Bananas"); break;
case "Cherries":
alert("Cherries"); break;
case "Mangoes":
case "Papayas":
alert("Mangoes and papayas"); break;
default:
alert(`Sorry,NOT Sorry,`);
}
alert("Is there anything else you'd like?");
var foo = 1;
let output = "Output: ";
switch (foo)
{
case 0: output += "So ";
case 1:
output += "what ";
output += "is ";
case 2: output += "your ";
case 3:
output += "NAME";
case 4:
output += "?";
alert(output); break;
case 5:
output += "!";
alert(output); break;
default:
alert("Please pick a number from 0 to 5!");
}
Value | Log text |
---|---|
foo is NaN 1 , 2 , 3 , 4 , 5 , or 0 |
Please pick a number from 0 to 5! |
0 |
Output: So What Is Your Name? |
1 |
Output: What Is Your Name? |
2 |
Output: Your Name? |
3 |
Output: Name? |
4 |
Output: ? |
5 |
Output: ! |
Redo: (mc/mark-all-like-this)
REDO: (mc/mark-all-like-this) rEdO:(xah-shrink-whitespaces)
Redo: (mc/mark-all-like-this)