+ 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
3 Réponses
+ 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
+ 1
Ok got it
+ 1
Thanks