0
Invalid left-hand side in postfix operation
this code is wrong, but why? It looks logical to me. Is it wrong because of a specific JS syntax rule? var a=0; alert(++(a++));
2 Answers
+ 5
This is because ++ and -- operators work on variables not the static numbers.
So ++0 or ++1 or 0++ or 1++ any such combination is not valid.
+ 2
it's a back to future issue in my mind.
you should carry out first the operation in the parenthesis but postfix will happen after alert.
Edit even without parenthesys it shows the same error so my theory is wrong.
Probably just wrong syntax