I want to use the switch
statement in some simple code i'm writing.
I'm trying to compare the variable in the parenthesis with values either < 13
or >= 13
.
Is this possible using Switch
?
var age = prompt("Enter you age");
switch (age) {
case <13:
alert("You must be 13 or older to play");
break;
case >=13:
alert("You are old enough to play");
break;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…