According to the ECMA Script specification , which, I believe, should conform to javascript in the multiply and add operators, it evaluates the left side before evaluating the right side. (see 11.5 and 11.6). I think this means the code should be equivalent
t = t - 1; int a = t * (t - 2); t = t / a; int b = t + t;
However, you should not always trust the specification as much as the implementation!
Your best bet in confusing cases like this is to experiment with various inputs to ambiguous lines of code in the original operating environment and try to determine what it does. Be sure to check the cases that can confirm the hypothesis, as well as check the cases that can falsify it.
Edit: Apparently, most JavaScript implements 3rd edition of ECMAScript, so instead I changed the link to this specification.
Null set
source share