Arithmetic Decrement
--
symbol is used for arithmetic decrement operator
arithmetic decrement operator takes a variable as operand, decrements the value in the variable by one
based on whether the decremented value is reflected in the variable during post executing the statement, or while executing the statement, there are two types of decrement operations: post-decrement, and pre-decrement.
a-- //post-decrement
--a //pre-decrement
Examples
1. decrement a
var a = 6;
a--;
console.log(a);
2. post-decrement a
var a = 6;
console.log(a--);
//6
console.log(a);
//5
3. pre-decrement a
var a = 6;
console.log(--a);
//5
console.log(a);
//5