+ 2
The problem is the ternary operator (age>1)? .It cannot concatenate with another string because it is a calculate( compare) process , not a string.
Modify : put all ternary operator in the parentheses "()":
for example : instead "You are " + age * 1 + (age > 1) ? "years" : " year";
we write "You are " + (age * 1) + ((age > 1) ? "years" : " year");
Hope to help you
0
What is your expected output if age = 45?