Numbers and Strings, Arithmetic Operators
The + (Addition) operator is used for both
addition and string concatenation; numbers are added, strings are
concatenated. Therefore, if one of the operands of the addition is a
string, the result will be a string.
'a' + 10
The result will be the string 'a10'.
'1' + 10
The result will be the string '110'.
20 + 10
The result will be number 30.
All other arithmetic operators */-@
(multiplication, division, subtraction and remainder) support numeric
strings. Meaning, that if one of the operands is a numeric string it,
will be automatically converted to a number.
Examples
20 / '10'
The result will be 2.
20 / 'a'
The result will be [Undefined].
tip
Remember that the addition operator concatenates strings. Example:
'my' + 10
The result will be the string my10.