A
Archos
The output on this code is not what I was expecting.
It prints "This won't be printed anyway" but I was expeting that it
were to run the first case. Whats' wrong?
==
var i = 6; switch (i) {
case i < 10:
console.log("i = " + i + " " + "is less than 10\n"); break;
case i > 10: case i < 0:
console.log("i = " + i + " " + "is either bigger than 10 or less
than 0\n"); break;
case i === 10:
console.log("i = " + i + " " + "is equal to 10\n"); break;
default:
console.log("This won't be printed anyway\n");
}
==
It prints "This won't be printed anyway" but I was expeting that it
were to run the first case. Whats' wrong?
==
var i = 6; switch (i) {
case i < 10:
console.log("i = " + i + " " + "is less than 10\n"); break;
case i > 10: case i < 0:
console.log("i = " + i + " " + "is either bigger than 10 or less
than 0\n"); break;
case i === 10:
console.log("i = " + i + " " + "is equal to 10\n"); break;
default:
console.log("This won't be printed anyway\n");
}
==