0
When writing a switch, how can I specify a case in which x is greater than something?
I tried case >7 but it returned an error...
1 ответ
+ 3
var x = 8;
switch (true) {
case (x > 7):
alert("x greater than 7.");
break;
default:
alert("x less or equal to 7");
break;
}
https://code.sololearn.com/W5X1kgU6HWgK/?ref=app