Appendix C

JavaScript Operator Precedence Chart

This appendix contains the operator precedence chart for JavaScript/ECMAScript (Fig. C.1) The operators are shown in decreasing order of precedence from top to bottom.

Operator Type Associativity
Fig. C.1 | JavaScript/ECMAScript operator precedence and associativity.
. member access left to right
[ ] array indexing
( ) function calls

++ increment right to left
-- decrement
- uanry minus
~ bitwise complement
! logical NOT
delete deletes an array element or object property
new creates a new object
typeof returns the data type of its argument
void prevents an expression from returning a value

* multiplication left to right
/ division
% modulus
+ addition
- subtraction
+ string concatenation

<< left shift left to right
>> right shift with sign extension
>>> right shift with zero extension

< less than left to right
<= less than or equal
> greater than
>= greater than or equal
instanceof type comparison

== equality left to right
!= inequality
=== identity
!== nonidentity

& bitwise AND left to right

^ bitwise XOR left to right

| bitwise OR left to right

&& logical AND left to right

|| logical OR left to right

?: conditional right to left

= assignment right to left
+= addition assignment
-= subtraction assignment
*= multiplication assignment
/= division assignment
%= modulus assignment
&= bitwise AND assignment
^= bitwise exclusive OR assignment
|= bitwise inclusive OR assignment
<<= bitwise left shift assignment
>> bitwise right shift with sign extension assignment
>>>= bitwise right shift with zero extension assignment

Valid XHTML 1.0 Strict

Valid CSS!