Freecodecamp: Challenge Increment a Number with JavaScript has an issue.

Created on 26 Jul 2016  ·  3Comments  ·  Source: freeCodeCamp/freeCodeCamp

bug on increment test
Challenge Increment a Number with JavaScript has an issue.
User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36.
The Result Should 88 but it appear to be 87 ,Can see on the screenshots

My code:

var myVar = 87;

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


Most helpful comment

Hi can someone please explain how: myVar = myVar should be changed
means: that i should create a new variable "myVar1"
myVar1 = ++myVar;

Would it not be better to give the instruction of:
Now create a new variable myVar1 and assign the incremented myVar to it

All 3 comments

Thanks for reporting, but your code is incorrect. Take another look at the instructions and if you're still stuck, please seek assistance in the Help Chat.

Happy coding!

oh sorry for the false report issue but already find my false and correct it
increment

Hi can someone please explain how: myVar = myVar should be changed
means: that i should create a new variable "myVar1"
myVar1 = ++myVar;

Would it not be better to give the instruction of:
Now create a new variable myVar1 and assign the incremented myVar to it

Was this page helpful?
0 / 5 - 0 ratings