July 1998
Intermediate to advanced
1456 pages
65h 5m
English
+ — NN 2 IE J1 ECMA 1
The addition operator. This operator
works with both numbers and strings, but its results vary with the
data types of its operands. When both operands are numbers, the
result is the sum of the two numbers; when both operands are strings,
the result is a concatenation of the two strings (in the order of the
operands); when one operand is a number and the other a string, the
number data type is converted to a string, and the two strings are
concatenated. To convert a string operand to a number, use the
parseInt() or parseFloat()
function.
var mySum = number1 + number2 var newString = "string1" + "string2"
Read now
Unlock full access