freeCodeCamp Challenge Guide: Decrement a Number with JavaScript

freeCodeCamp Challenge Guide: Decrement a Number with JavaScript
0

#1

You can easily decrement or decrease a variable by 1 with the -- operator.

i--;

is the equivalent of

i = i - 1;

Try this myVar = myVar - 1;
myVar = 12-1;

myVar–;

Note: The entire line becomes i--;, eliminating the need for the equal sign.

myVar = myVar - 1;
myVar = 12-1;

myVar–;


#2