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.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?