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

  is this code is correct what i have done

var myVar = 87;

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





       **Your browser information:**

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

**Challenge:**  Increment a Number with JavaScript

**Link to the challenge:**
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/increment-a-number-with-javascript

Hello @arunak , welcome to the forum.

The increment operation has a different meaning according if it’s a prefix or a postfix:

If used postfix, with operator after operand (for example, x++ ), the increment operator increments and returns the value before incrementing.

If used prefix, with operator before operand (for example, ++x ), the increment operator increments and returns the value after incrementing.

So, are you sure you have to prefix and not postfix the operation?

More info about incrementing here: Increment MDN.

Hope this helps :slight_smile:

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