Pre,Post Increment,Decrement

++ and --, when placed in front of a variable, causes the value of the variable to be incremented by 1 and decremented by 1 respectively before the expression is evaluated. Placing them at the back of the variable causes the increment/decrement operation to be carried out after the evaluation. Individually, v++ is identical to v = v+1.


var n = 0;
console.log(n++);
console.log(n++);
console.log(n++);
console.log(++n);
console.log(++n);
console.log(++n);
console.log(n-- * 3);
console.log(--n * 3);

0 1 2 4 5 6 18 12