Javascript evaluation order for operators

前端 未结 4 929
灰色年华
灰色年华 2020-12-16 21:02

Which of the following expressions will always precede left to right in all browsers(particularly IE6+, F3+, Opera 9+, Chrome)? For example the window should always alert

4条回答
  •  有刺的猬
    2020-12-16 22:06

    ECMAScript 5 specifies the order of evaluation of the operands for all operators. In the case of every operator in your code snip the evaluation order is left-to-right. I'm not sure anyone could answer about the behavior of all browsers though.

    Edit: See also ECMAScript 3. Evaluation order is defined the same way.

提交回复
热议问题