It seems like you’re also not clear on what the assignment operator
= does. It is not the same as an equals sign in math, even though it uses the same symbol.
So the line
myVar + 1 = myVar++; results in a
myVar + 1 isn’t something you can directly assign a new value to.
===. So, to check if
myVar + 1 is equal to
myVar++, you could do this:
console.log(myVar + 1 === myVar++);
However, this log
false, because the
++ operator is applied after evaluating the current expression if used like that.
There is a way to apply it before evaluating the current expression, which is by putting it before the variable. So:
myVar + 1 === ++myVar;