Basic JavaScript - Increment a Number with JavaScript

Tell us what’s happening:

Describe your issue in detail here.
When i click run test it doesnt do anything and i dont know why

Your code so far

 myVar = 87;

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

Your browser information:

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

Challenge Information:

Basic JavaScript - Increment a Number with JavaScript

Look at the console pane. It is telling you there is something wrong with your code.

You can’t increment a number like that. The ++ operator can only be used with a variable.

Read the instructions closely again:

i++;

is the equivalent of

i = i + 1;

The instructions are using the variable i. The challenge is using the variable myVar. Can you see the similarity?

1 Like

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