Why error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
28th Mar 2021, 9:59 AM
Alesh Boldrew
Alesh Boldrew - avatar
4 Answers
+ 6
A char is this 1 but not this 13. Only one character.
28th Mar 2021, 10:05 AM
JaScript
JaScript - avatar
+ 3
Алексей Болдырев Because char contains only one character but here is 2 character.
28th Mar 2021, 10:06 AM
A͢J
A͢J - avatar
+ 2
'1' and '3' are both one character. When you have more than one, it's considered a string (or an array of characters) try the same code with just a single character, either '1' or '3'
28th Mar 2021, 10:05 AM
Slick
Slick - avatar
+ 2
Thanks! I am understand! All the best! 😁
28th Mar 2021, 10:07 AM
Alesh Boldrew
Alesh Boldrew - avatar