Merge pull request #1877 from janina213/patch-1
add break to switch case example
This commit is contained in:
commit
f2a099bd0b
1 changed files with 1 additions and 0 deletions
|
@ -213,6 +213,7 @@ let age = prompt('Your age?', 18);
|
||||||
switch (age) {
|
switch (age) {
|
||||||
case 18:
|
case 18:
|
||||||
alert("Won't work"); // the result of prompt is a string, not a number
|
alert("Won't work"); // the result of prompt is a string, not a number
|
||||||
|
break;
|
||||||
|
|
||||||
case "18":
|
case "18":
|
||||||
alert("This works!");
|
alert("This works!");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue