Increment (++)

The increment operator (++) increments (adds one to) its operand and returns a value.


Operator: x++ or ++x


If used postfix, with operator after operand (for example, x++), the increment operator increments and returns the value before incrementing.

If used prefix, with operator before operand (for example, ++x), the increment operator increments and returns the value after incrementing.


Postfix increment

let x = 3;
y = x++;

// y = 3
// x = 4

Prefix increment

let a = 2;
b = ++a;

// a = 3
// b = 3


ECMAScript (ECMA-262)
The definition of 'Increment operator' in that specification.

Browser compatibility

ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.js
Increment (++)Chrome Full support 2Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support 3Safari Full support 4WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 3.2Samsung Internet Android Full support 1.0nodejs Full support 0.1.100


Full support
Full support

See also