0
Age Converter
Okay, so im trying to make an age converter and your not going to say you 1 years old, 1 months, and 1 days old so i tried changing that from a metho somebody taught me which is an if statement i trie using and it did something https://code.sololearn.com/WGEqEcOTJ8WV
5 Respuestas
+ 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
+ 1
I got it
0
I want it to say 1year old, 1 month, 1day or something like fhat if tou know what i mena
0
What is your expected output if age = 45?
0
No, nevermind its fine