Increment a Number with JavaScript- help needed

Increment a Number with JavaScript- help needed
0.0 0

#1

Tell us what’s happening:
I tried both below codes but none is working for me.

++myVar;

myVar= ++myVar;

one is giving 88 value but can’t pass the test.

I am receiving below reply

myVar = myVar + 1; should be changed


#2

please share the link to the lesson so that i can see :blush:


#3

I just passed both tests but test passed without space in myVar++; but console log is giving an syntax error with this . please see below link

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


#4

Subtle difference between ++myVar and myVar++
Read up on prefix and postfix

That probably works but wasn’t what the test was looking for. You don’t have to assign back to the variable when you increment. It is incremented in place.