Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The addition (+) operator produces the sum of numeric operands or string concatenation.
The + operator is overloaded for two distinct operations: numeric addition and string concatenation. When evaluating, it first coerces both operands to primitives. Then, the two operands' types are tested:
String concatenation is often thought to be equivalent with template literals or String.prototype.concat(), but they are not. Addition coerces the expression to a primitive, which calls valueOf() in priority; on the other hand, template literals and concat() coerce the expression to a string, which calls toString() in priority. If the expression has a [Symbol.toPrimitive]() method, string concatenation calls it with "default" as hint, while template literals use "string". This is important for objects that have different string and primitive representations — such as Temporal, whose objects' valueOf() methods all throw.
You are advised to not use "" + x to perform string coercion.
Other non-string, non-BigInt values are coerced to numbers:
You cannot mix BigInt and number operands in addition. null, undefined, and boolean values are coerced to numbers and are forbidden as well.
Strings have priority over other types, so adding a string to a BigInt produces string concatenation rather than a TypeError.
To do addition with a BigInt and a non-BigInt, convert either operand:
If one of the operands is a string, the other is converted to a string and they are concatenated:
| ECMAScript® 2027 Language Specification # sec-addition-operator-plus |
Enable JavaScript to view this browser compatibility table.
This page was last modified on May 11, 2026 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.