Is the order of execution of operations in Javascript guaranteed to be the same at all times?
问题 When I do something like this: var x = 5; console.log( x + (x += 10) ); //(B) LOGS 10, X == 20 console.log( (x += 10) + x ); //(A) LOGS 0, X == 30 The difference in the returned value between (A) and (B) is explained by the value of x at the time it becomes evaluated. I figure that backstage something like this should happen: TIME ----> (A) (x = 5) + (x += 10 = 15) = 20 (B) (x += 10 == 15) + (x == 15) = 30 But this only holds true if and only if x is evaluated in the same left-to-right order