Skip to content

Output is showing incorrect. myVar++; still giving output 87. #7611

Open
kaustubh6 opened this Issue · 2 comments

3 participants

@kaustubh6

Challenge Increment a Number with JavaScript has an issue.
User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0.
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++;

@raisedadead
Free Code Camp member

@kaustubh6 : Check the instructions

image

I know it looks a bit weird, but that's how assignment and expression evaluation work.

Please feel to reach out to the Help Chat room should you need assistance.

@SaintPeter : I am not sure if we want to introduce concept of pre & post increment/decrement here or until later or point to a wiki article, given the scope and target audience and the complexity of the challenge. But I would love your feedback on this. Keeping this open for opinion.

@SaintPeter
Free Code Camp member

@raisedadead We've discussed this a bit before, but it's not clear that we can cleanly introduce the idea of pre/post increment without causing more confusion. The Hint line was our compromise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.