Addition (+)

The addition operator (+) produces the sum of numeric operands or string concatenation.

Syntax

x + y

Examples

Numeric addition

// Number + Number -> addition
1 + 2 // 3

// Boolean + Number -> addition
true + 1 // 2

// Boolean + Boolean -> addition
false + false // 0

String concatenation

// String + String -> concatenation
'foo' + 'bar' // "foobar"

// Number + String -> concatenation
5 + 'foo' // "5foo"

// String + Boolean -> concatenation
'foo' + false // "foofalse"

Specifications

Specification
ECMAScript Language Specification
# sec-addition-operator-plus

Browser compatibility

BCD tables only load in the browser

See also