You might have seen expressions used in switch condition but it is also possible to use for switch cases by assigning true value for the switch condition. Let's see the weather condition based on temparature as an example,
const weather = (function getWeather(temp) {
switch (true) {
case temp < 0:
return "freezing";
case temp < 10:
return "cold";
case temp < 24:
return "cool";
default:
return "unknown";
}
})(10);