Up next

Learn Basic JavaScript Decrement a Number with JavaScript freeCodeCamp org

1 Views· 10/01/23
Generative AI
Generative AI
3 Subscribers
3

Hi,guys in this lesson we learnt the increment with the assignment operator

here is the summary
You can easily decrement or decrease a variable by one with the -- operator.

i--;

is the equivalent of

i = i - 1;

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

Change the code to use the -- operator on myVar.

Show more

 0 Comments sort   Sort By


Up next