tarbie
#1
Tell us what’s happening:
Your code so far
var myVar = 87;
// Only change code below this line
myVar = myVar + 1;
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript
Wylted
#2
Here is an eplanation of how to do it;
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.
Knowing this, how would you simplify myVar = myVar +1
to mean the exact same thing with the knowledge above that ++ adds one to the variable?