Basic Increment a Number with JavaScript

Tell us what’s happening:
I cannot get the second parameter, which is; " myVar = myVar + 1; should be changed" to change to completed. What the heck am I doing wrong, I did change that line. WTH

Your code so far

var myVar = 87;

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36.

Link to the challenge:

From the lesson (emphasis added):

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


But not in the right way

Remember that i++ is shorthand for i = i + 1

++i is yet an other thing, it returns the old value while incrementing the variable

i still am unclear on the difference between incrementing before or after, or ++1 vs 1++. I understand all the words you used to describe it but I just don’t get it somehow. shrugs such a weird phenomenon/feeling, never experienced anything quite like it.

So odd how you can be going right along and then the silliest thing can derail you and have you adding stuff that has no place and breaking your keyboard while trying to test and it is always the simplest little error… grrr


1 Like