Stuck here. myVar = myVar + 1 needs to be changed

Tell us what’s happening:

Your code so far


var myVar = 87;

// Only change code below this line

myVar = myVar + 1;
myVar = myVar++;

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript

If you just want to pass the challenge, you should delete the first line with “myVar= MyVar + 1” since

the guideline tell you "myVar = myVar + 1; should be changed"

Also you could improve ‘myVar = myVar++’ // It could be shorter.

Kind regards,
Helion

1 Like

If you do this and check the value of myVar afterward, it will still be the same
Remember, myVar++ is the shorthand version of myVar = myVar + 1

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

1 Like

Solved! I took out the equal sign, and BINGO! Thank you for the help!