Skip to Content
The Increment and Decrement Operator

Other mathematical assignment operators include the increment operator (++) and decrement operator (--).

The increment operator will increase the value of the variable by 1. The decrement operator will decrease the value of the variable by 1. For example:

let a = 10; a++; console.log(a); // Output: 11
let b = 20; b--; console.log(b); // Output: 19

Just like the previous mathematical assignment operators (+=, -=, *=, /=), the variable’s value is updated and assigned as the new value of that variable.



Using the increment operator, increase the value of gainedDollar.


Using the decrement operator, decrease the value of lostDollar.

Folder Icon

Take this course for free

Already have an account?