Favorites

JavaScript += Addition assignment Operator

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
+=
JavaScript Assignment OperatorThis operator is supported by all modern browsers.
Updated 28th November 2026

The addition assignment operator (+=) adds a value to a variable, or appends to a string, and stores the result. x += y is short for x = x + y.

Description

The addition assignment operator += adds the right operand to the variable and assigns the result back to it. It follows the same rules as +, so with strings it appends. x += y is equivalent to x = x + y, except that x is only evaluated once.

Because += follows the rules of +, a number added to a string variable is appended as text, and a string added to a number variable turns it into a string. Building long strings with += in a loop is fine in modern engines, but collecting parts in an array and calling join() can be clearer.

Compound assignment operators are evaluated from right to left like plain assignment, and the expression itself returns the new value, although using that value inside a larger expression usually makes code harder to read. The left side must be something that can be assigned to: a variable declared with let or var, an object property or an array element. Using one on a const throws a TypeError.

Properties

Operator
+=
Category
Assignment
Precedence
2 (1 is lowest, 18 is highest)
Associativity
right-to-left

Syntax

x += y

Example

let total = 10;
total += 5;
console.log(total);
let html = '<ul>';
html += '<li>Item</li>';
html += '</ul>';
console.log(html);

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.

This operator is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee