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

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

You can easily increment or add one to a variable 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 = 87;

// Only change code below this line
myVar++;
myVar = 88;

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