Increment ++/decrement --

Operators ++ and -- can be placed both after and before the variable.

Operators ++/-- can be used inside an expression as well. Their precedence is higher than most other arithmetical operations.

Let counter = 2;
counter++;      // works the same as counter = counter + 1, but is shorter
alert( counter ); // 3
Let counter = 2;
    counter--;      // works the same as counter = counter - 1, but is shorter
    alert( counter ); // 1

Increasing or decreasing a number by one is among the most common numerical operations.

Increment ++/decrement -- — Structure map

Clickable & Draggable!

Increment ++/decrement -- — Related pages: