difference entre i++ et ++i javascript code example
Example: javascript diffence between a++ and ++a
// ++i returns the value of i after it has been incremented. i++ returns the value of i before incrementing.
// When the ++ comes before its operand it is called the "pre-increment" operator, and when it comes after it is called the "post-increment" operator.
// This distinction is only important if you do something with the result.
var i = 0, j = 0;
alert(++i); // alerts 1
alert(j++); // alerts 0