Appendix C JavaScript Operator Precedence Chart


Home

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.

JavaScript/ECMAScript operator precedence and associativity.

Operator Type Associativity
. member access left to right
[] array indexing
() function calls
++ increment right to left
-- decrement
- unary 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 left to right
- 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
& bitwiase 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 asssignment
*= multiplication assignment
/= division assignment
%= modulus asssignment
&= 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