Increment and Decrement Operators
|Top Previous Next|
Operators: ++ --
The increment and decrement operators may occur before (pre-increment, pre-decrement) or after (post-increment, post-decrement) the l-value. An l-value is a variable, array element, or property of an object. The operator converts the value of the l-value to type Number if necessary, adds (increment) or subtracts (decrement) one to that value, and assigns the result back to the l-value as a side effect.
The result of the pre-increment and pre-decrement operators is the final value stored in the l-value. The result of the post-increment and post-decrement operators is the value of the l-value before the increment or decrement took place (but after the conversion to Number, if necessary).