+ 1

What does it means when string is multiplied by a no. like "2"*3+5+"6".Is string is multiplied as a no.coz it can't concatenate.

java

9th Feb 2018, 11:36 PM
Manpreet Singh
Manpreet Singh - avatar
3 ответов
+ 2
I think it is javascript not java They are different "2"*3 = 6 "2"+3 = 23 It's bc + operator is also called as concatenate string operator if left n or right n is not a number(I mean other than number not NaN) left and right will be concatenated as string in javascript if both are numbers that will be worked fine now why "2"*3=6? bc of * operator is not string operator at all so "2" is evaluated into 2 and mutiply by 3 very well
10th Feb 2018, 12:03 AM
Yanothai Chaitawat
Yanothai Chaitawat - avatar
+ 1
Ok got it
10th Feb 2018, 12:16 AM
Manpreet Singh
Manpreet Singh - avatar
+ 1
Thanks
10th Feb 2018, 12:16 AM
Manpreet Singh
Manpreet Singh - avatar