freeCodeCamp Challenge Guide: Increment a Number with JavaScript

freeCodeCamp Challenge Guide: Increment a Number with JavaScript
0

#1

var myVar = 87;

myVar = 86 + 1;
myVar++;

Paste it.


#2

Why isn’t this working?
"var myVar = 87;

// Only change code below this line
myVar = ++myVar;"
it says myVar = myVar should be changed but it is changed it says ++myVar now, so what exactly needs to be different?


#3

Oh jeez it was even easier than I thought if anyone is struggling the answer is just
"++myVar" no myVar = or anything.


#4

Thankyou My fellow camper. I was stuck on this one although I knew I needed to erase the equal sign I didn't realize I needed to delete eveyrthing except myVar then add ++ in front myVar I didnt realize that i represented or is the same thing as myVar.

P.S. dont forget the semicolin guys and gals
Happy codeing.


#5

var myVar = 87;

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


#6

Thanks - I was struggling with this one, too!


#7

I see that this answer can work 2 ways. I feel like the answer should be:

myVar++;

because the “i” in the increment myVar, there for it should go first. Both ways work. I just fear that the order of things will matter more later. ALSO i got this wrong the first time because I didn’t use CamelCase :tired_face:


#8

Is this incorrect?

var myVar = 87;

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