HTML and CSS Reference

In-Depth Information

In Table 5.1 the operators on the same line are of equal precedence. The rows are in

order of highest to lowest precedence.

Table 5.1
Precedence and Associativity

Operator

Description

Associativity

()

Parentheses

Left to right

++ - -

Auto increment, decrement

Right to left

!

Logical NOT

Right to left

* / %

Multiply, divide, modulus

Left to right

+ -

Add, subtract

Left to right

+

Concatenation

Left to right

< <=

Less than, less than or equal to

Left to right

> >=

Greater than, greater than or equal to

Left to right

= = !=

Equal to, not equal to

Left to right

= = = != =

Identical to (same type), not identical to

Left to right

&

Bitwise AND

Left to right

Bitwise OR

^

Bitwise XOR

~

Bitwise NOT

<<

Bitwise left shift

>>

Bitwise right shift

>>>

Bitwise zero-filled, right shift

&&

Logical AND

Left to right

||

Logical OR

Left to right

? :

Ternary, conditional

Right to left

= += - = *= /= %= <<= >>=

Assignment

Right to left

,

(comma)