JavaScript: The Definitive Guide, Sixth Editio javaScript权威指南(第6版) pdf 文字版-文字版, javascript电子书, 和javascript 有关的电子书:

4.7.6 Operator Associativity

4.7.6 Operator Associativity


In Table 4-1 , the column labeled A specifies the associativity of the operator. A value of L specifies left-to-right associativity, and a value of R specifies right-to-left associativity. The associativity of an operator specifies the order in which operations of the same precedence are performed. Left-to-right associativity means that operations are performed from left to right. For example, the subtraction operator has left-to-right associativity, so:

w = x - y - z;


is the same as:

w = ((x - y) - z);

On the other hand, the following expressions:

x = ~-y; w = x = y = z; q = a?b:c?d:e?f:g;

are equivalent to:

x = ~(-y); w = (x = (y = z)); q = a?b:(c?d:(e?f:g));

because the unary, assignment, and ternary conditional operators have right-to-left associativity.

欢迎转载,转载请注明来自一手册:http://yishouce.com/book/1/31322.html
友情链接It题库(ittiku.com)| 版权归yishouce.com所有| 友链等可联系 admin#yishouce.com|粤ICP备16001685号-1