var val = prompt (“enter Age”); const d = 22 ; switch (true) { case (d == 2): alert(“You are eligible”); break; case ( d >= 18 ): alert(“You are not eligible”); break; case (d >= 39): alert ( “Get a driver”); break; case (d >=59): alert (“is too old to drive a car” ); break; case (d > 60): alert (“Call your grandson to drive for you”); break; default: alert (“Drive”);
i understand what you want but we can not just give you answer .
so you have to write your own code and then share that code if you stuck so we can tell what’s wrong.
hint is use switch to solve this problem
syntax is
switch(condition){
case 1 :
// code when case one is true
break;
other cases:
}