I'm just wondering if there's a way to make this sort of thing work in a switch statement, I'm aware that it's very possible in an else if statement but I would prefer to go with a switch statement, below I've attached an example piece of code to show what I mean...
let money = 42;
switch (money) {
case < 10:
console.log('You have $10 or less USD');
break;
case < 50:
console.log('You have $50 or less USD');
break;
case < 100:
console.log('You have $100 or less USD');
break;
default:
console.log('You are rich! Over $100);
break;
}
if this worked the way I wanted it would print "You have $50 or less USD" as money is < 50 but > 10.
Thanks in advance, Lachie.