Basic JavaScript - Increment a Number with JavaScript

Tell us what’s happening:
Describe your issue in detail here.

I have figured out the correct answer. it is “myVar++”.
But now, I m really confused about that why the following code DO run. “myVar = ++myVar” and “myVar++” are totally different.
plz help me.

Your code so far

let myVar = 87;

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

Your browser information:

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

Challenge: Basic JavaScript - Increment a Number with JavaScript

Link to the challenge:

The updates ++tVar or tVar++ also with --
will determine whether the assignment is done before or after the update

If you write this (keyword let omitted):

a=5
a++
// or
++a

There is no difference because there isn’t any assignment. Instead

a=5
b= ++a

In that code, b is assigned after a is updated, we have:

a b
6 6
In this code however
a=5;
b=a++
a b
6 5

As you can see in both cases a will be 6

Last but not least you can increment without update:

a=5
b = a + 1