JavaScript + Addition Operator
The addition operator (+) adds two numbers, or joins two strings together when either operand is a string.
Description
The addition operator + produces the sum of two numbers. If either operand is a string, it instead converts the other operand to a string and joins them (concatenation), so 1 + '2' is '12'. That double role is a frequent source of bugs when numbers arrive as strings, for example from form fields; convert them first with Number().
Operands are evaluated left to right, so 1 + 2 + '3' is '33' but '1' + 2 + 3 is '123'. Template literals are often clearer than + for building strings. It also works with BigInt values, but not with a mix of BigInt and Number.
The + operator first converts objects to primitives, which is why adding arrays or objects gives strange strings such as [1] + [2] being "12". When adding decimals, results can show floating point rounding, such as 0.1 + 0.2; round for display with toFixed() or work in whole units, such as cents. The unary form, +value, is a different operator that converts a value to a number.
Properties
- Operator
+- Category
- Arithmetic
- Precedence
- 11 (1 is lowest, 18 is highest)
- Associativity
- left-to-right
Syntax
x + yExample
Browser Support
The following information will show you the current browser support for the + operator. Hover over a browser icon to see the version that first introduced support for this operator.
Desktop





Tablets & Mobile





