Increment a Number with JavaScript issues

Tell us what’s happening:

Hi Guys’ rookie mistake i guess but the challenge is not completing when I run tests.
I am changing code:

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

which i think is correct but it is failing the 1st 2 criteria

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/71.0.3578.98 Safari/537.36.

Read better the challenge description

myVar++ is shorthand for myVar = myVar + 1

I know :slight_smile: This is what i have:

var myVar = 87;

// Only change code below this line

myVar = myVar++;

is that not correct?

myVar++ is shorthand for myVar = myVar + 1
myVar = myVar++ is a different thing

Solved it! I am an idiot lol. I was assigning myVar the value of myVar++ which didn’t exist. Thanks for the help.

1 Like