If there is a numerical operation then the string is converted into a number. The + is a string concatenation operator and a numerical operator, string wins in this case. So "1" concatenate the result of 1*2 = 2 becomes "12" as a string.
Note that + on its own is always a numerical operator which is why you might see this:
functionadd(a,b){return+a++b}
The +a is bound to convert a to be a number (if possible) etc.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
If there is a numerical operation then the string is converted into a number. The + is a string concatenation operator and a numerical operator, string wins in this case. So "1" concatenate the result of 1*2 = 2 becomes "12" as a string.
Note that
+
on its own is always a numerical operator which is why you might see this:The
+a
is bound to converta
to be a number (if possible) etc.