X++ means that returns X or executes the statement first then increments X.
++X means that increments X first then returns or executes the statement.
var x = 10 ;
var y = x++ ; // y = 10 , x = 11
var z = ++x ; // z = 12 , x =12
and for decrement?
For decrement, it's the same as increment.
var x = 10 ;
var y = x-- ; // y = 10 , x = 9
var z = --x ; // z = 8 , x = 8
Top comments (0)