basics of javascript

Tell us what’s happening:

Your code so far


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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36.

Challenge: Increment a Number with JavaScript

Link to the challenge:

The variable myVar was created and the number 87 was assigned to it.
MyVar ++ will add 1 to myVar (ie 87 + 1), because ++ means that you are adding 1 to the variable.

It could be:
myVar = myVar + 1;
myVar + = 1;
myVar ++;

So, after that, if you run:
console.log(myVar);
it you return 88.

Your code is missing a semicolon after myVar++, which causes the test to fail.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.