increment and decrement operators in javascript code example
Example 1: decrement operator in javascript
// Decrement
let b = 1;
b--; //post decrement
--b; // pre decrement
Example 2: javascript increment
x = 0;
//pre-increment
++x;
//post-increment
x++;
Example 3: javascript decrement
// Increment
let a = 1;
a++;
++a;
// Decrement
let b = 1;
b--;
--b;
Example 4: increment operator in javascript
// Increment
let a = 1;
a++; // Post Increment
++a; // Pre Increment