Increment and Decrement

Pre- and Post- Increment and Decrement

++n changes the variable and yields the new value; n++ yields the old value, then changes it. With let n = 5, console.log(n++, n, ++n, n--, --n, n) prints 5 6 7 7 5 5. The operand must be a variable or property (5++ is a SyntaxError); a string "5" becomes the number 6, and 9n becomes 10n. Outside for headers, n += 1 is clearer.