Addition (+)
증가 연산자addition operator (+
)는 숫자 또는 여러 문자열의 더합니다.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
Syntax
Operator: 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
Browser compatibility
BCD tables only load in the browser