switch-caseで不等号による条件分岐。
var answer=prompt("How old are you?")
switch(true){
case answer<20:
console.log("you are under " + answer)
break;
case answer<30:
console.log("you are under "+ answer)
break;
case answer<40:
console.log("you are under "+ answer)
break;
default:
console.log("have fun")
}