I\'m studying for an exam on JavaScript at the moment. I\'ve also got a little knowledge of C and Perl so I\'m familiar with prefix and postfix operators in all three langua
In C, the line
x += x--;
is undefined behaviour. It seems like your particular compiler is treating it like:
oldx = x--;
x = x + oldx
However, the ECMAScript specification does specify op= - and it gets the value of the left-hand-side before evaluating the right-hand-side.
So it would be equivalent to:
oldx = x--;
x = oldx + oldx