Favorites

JavaScript ++ Increment Operator

☕
Enjoying this site?

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

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

The increment operator (++) adds one to a variable. Placed after the variable it returns the old value; placed before, it returns the new value.

Description

The increment operator ++ adds 1 to its operand and stores the result. In postfix form, x++, the expression returns the value before incrementing; in prefix form, ++x, it returns the value after. When used on its own line, as in a for loop, there's no difference.

The operand must be something that can be assigned to, such as a variable or property; 5++ is a syntax error. Many style guides prefer x += 1 because it's clearer.

Because x++ both changes a variable and returns a value, using it inside larger expressions, such as arr[i++] = value, packs two actions into one line and can be easy to misread. It's clearest on a line of its own or in a for loop's update. Applied to a string, the value is converted to a number first, so let s = '5'; s++ leaves s as the number 6. It also works with BigInts.

Properties

Operator
++
Category
Arithmetic
Precedence
15 (1 is lowest, 18 is highest)
Associativity
n/a

Syntax

x++
++x

Example

let a = 5;
console.log(a++, a);
let b = 5;
console.log(++b, b);
for (let i = 0; i < 3; i++) console.log('i =', i);

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