+ 1

Why it is showing error?

While I was trying to solve a function about age it was showing wrong.What is the prblm here? var age=26; var ageStat=(age<10)?"Child":(age<18)?"young":(age<40)?"Mature":(age>40)?"Old"; document.write(ageStat);

10th Jul 2021, 6:45 PM
Tanjid Ahsan Riad
Tanjid Ahsan Riad - avatar
2 Réponses
+ 6
// the last one has to be an answer var age=26; var ageStat=(age<10)?"Child":(age<18)?"young":(age<40)?"Mature":"Old"; document.write(ageStat);
10th Jul 2021, 6:52 PM
JaScript
JaScript - avatar
+ 2
Thanks a lot
10th Jul 2021, 6:55 PM
Tanjid Ahsan Riad
Tanjid Ahsan Riad - avatar