FreeCodeCamp.com - Basic JavaSript - Decrement a Number with JavaScript

Link:

https://www.freecodecamp.com/challenges/decrement-a-number-with-javascript#?solution=%0Avar%20myVar%20%3D%2011%3B%0A%0A%2F%2F%20Only%20change%20code%20below%20this%20line%0AmyVar--%3B%0AmyVar%20%3D%20myVar%3B%0A%0A

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.

Instructions

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

Sollution:
var myVar = 11;

// Only change code below this line
myVar--;
myVar = myVar;

Komentáře

Populární příspěvky z tohoto blogu

FreeCodeCamp.com - Basic JavaSript - Passing Values to Functions with Arguments

FreeCodeCamp.com - Basic JavaSript - Word Blanks

FreeCodeCamp.com - Basic JavaSript - Understand String Immutability