0
can i know a reason of the fail of my coding?
I made the code like this but it doesn't work. I can't see any output although I can see the prompt box can I know a reason?? var age = prompt("enter your age"); var isAdult = (age <18) ? "Too young": (age <30) ? "middle": (age <40)? "last": (age <50) ? "old":
1 Answer
0
The last ternary is not terminated correctly. Try this:
var isAdult= age<18?"Too Young" :
age<30?"middle":
age<40?"last" : "old" ;
Pay attention to the last row, where I have omitted your "age<50"