showing results for - "javascript diffence between a 2b 2b and 2b 2ba"
Camilla
28 Apr 2018
1// ++i returns the value of i after it has been incremented. i++ returns the value of i before incrementing.
2
3// 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.
4
5// This distinction is only important if you do something with the result.
6
7var i = 0, j = 0;
8
9alert(++i);  // alerts 1
10alert(j++);  // alerts 0