This simple problem gives me an error. Does not get the correct answer. I will be glad if you help.
let point = 90;
switch (point) {
case point >= 51 && point <= 60:
console.log('Your price: E');
break;
case point >= 61 && point <= 70:
console.log('Your price: D');
break;
case point >= 71 && point <= 80:
console.log('Your price: C');
break;
case point >= 81 && point <= 90:
console.log('Your price: B');
break;
case point >= 91 && point <= 100:
console.log('Your price: A');
break;
default:
console.log('You did not pass');
}
Output:
You did not pass
question from:
https://stackoverflow.com/questions/65649146/switch-case-in-js 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…