Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015년 7월.
더하기 연산자(+)는 숫자 피연산자의 합을 구하거나, 문자열을 서로 연결합니다.
+ 연산자는 숫자 덧셈과 문자열 연결 두 가지 작업을 수행합니다. 계산 시에 먼저 두 개의 피연산자를 원시 타입으로 변환합니다. 그 후에, 두 피연산자의 타입을 확인합니다.
종종 템플릿 리터럴이나 String.prototype.concat()이 문자열 연결과 동일하다고 생각하지만, 그렇지 않습니다. 더하기 연산자는 먼저 valueOf()를 호출하여 표현식을 원시 타입으로 변환합니다. 반면에, 템플릿 리터럴과 concat()은 먼저 toString()을 호출합니다. 만약 표현식에 @@toPrimitive 메서드가 있는 경우, 문자열 연결은 "default"를 힌트로 사용하고, 템플릿 리터럴은 "string"을 사용합니다. 이 차이는 문자열과 원시 표현이 다른 객체에 중요합니다. 예를 들어 valueOf() 메서드가 에러를 내는 Temporal 같은 객체가 있습니다.
문자열 변환을 위해 "" + x를 사용하는 것은 좋지 않습니다.
| ECMAScript® 2027 Language Specification # sec-addition-operator-plus |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025년 6월 27일 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.