Freecodecamp: Increment a Number with JavaScript has a misleading test case

Created on 18 Jan 2017  ·  6Comments  ·  Source: freeCodeCamp/freeCodeCamp

Challenge Increment a Number with JavaScript has an issue.
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36.
Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:


var myVar = 87;

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


first timers only help wanted

Most helpful comment

Hi can I try to do this?

All 6 comments

@ankush2604 Thank you for reporting the issue.
Your task is just to do that "Change the code to use the ++ operator on myVar."

I think that the test "myVar = myVar should be changed" might be little misleading, this is why you have something like that in your code. Some mod might take a look and maybe explain IF we need this test-description there at all?

Thanks @OFFLlNE

Yes, this test case can be misleading and should be updated to

myVar = myVar + 1; should be changed.

Hi can I try to do this?

@AngShiYa Sure thing! Follow the guide for contributing at: https://github.com/FreeCodeCamp/FreeCodeCamp/blob/staging/CONTRIBUTING.md

If you run into any problems, feel free to ask for help in the Contributors Gitter chat.

Whoops - accidentally clicked the assign button!

Just use
myVar++;

Was this page helpful?
0 / 5 - 0 ratings