I expected it to be the first case, but why the default came in the result?
let age = 19;
switch (age) {
case age>=18:
console.log("You are adult");
break;
default :
console.log("You are teenager");
}
I expected it to be the first case, but why the default came in the result?
let age = 19;
switch (age) {
case age>=18:
console.log("You are adult");
break;
default :
console.log("You are teenager");
}