Operator Precedence (Definition)

A means of controlling execution priority in expressions.

Availability:

ECMAScript edition - 2

The operators below are listed in descending order or precedence. The associativity column indicates the direction (left-to-right or right-to-left) in which items are evaluated.

OperatorDescriptionAssoc
()Grouping operatorL-R
[]Array index delimiterL-R
.Property accessorL-R
++Postfix incrementL-R
--Postfix decrementL-R
!Logical NOTR-L
~Bitwise NOTR-L
++Prefix incrementR-L
--Prefix decrementR-L
-Negate operandL-R
deleteDelete a property from an objectR-L
newInvokes an object constructorR-L
typeofDetermines the type of a valueR-L
voidAlways yields the undefined valueR-L
*MultiplyL-R
/DivideL-R
%RemainderL-R
+Convert the operand to a numeric valueL-R
+AddL-R
-SubtractL-R
+Concatenate stringL-R
<<Bitwise shift leftL-R
>>Bitwise shift rightL-R
>>>Bitwise shift right (unsigned)L-R
<Compare less thanL-R
<=Compare less than or equal toL-R
>Compare greater thanL-R
>=Compare greater than or equal toL-R
inProperty is in objectL-R
instanceofObject is instance of another objectL-R
==Compare equal toL-R
!=Compare NOT equal toL-R
===Compare identically equal toL-R
!==Compare identically NOT equal toL-R
&Bitwise ANDL-R
^Bitwise XORL-R
|Bitwise ORL-R
&&Logical ANDL-R
||Logical ORL-R
?:Conditional executionR-L
=AssignR-L
*=Multiply and assignR-L
/=Divide and assignR-L
%=Remainder and assignR-L
+=Add and assignR-L
-=Subtract and assignR-L
<<=Bitwise shift left and assignR-L
>>=Bitwise shift right and assignR-L
>>>=Bitwise shift right (unsigned) and assignR-L
&=Bitwise AND and assignR-L
|=Bitwise inclusive OR and assignR-L
^=Bitwise XOR and assignR-L
,Argument delimiterL-R
;Empty statementL-R
{ }Delimit code blockL-R

See also:Associativity, Object property delimiter (.), Primary expression

Cross-references:

ECMA 262 edition 2 - section - 11.1.4

ECMA 262 edition 3 - section - 11.1.6