JavaScript Operator Precedence

Operator precedence in JavaScript, decides which operator evaluates first, then which evaluates second, and so on. I've listed all the JavaScript operators, where the first operator has the highest precedence, and the last operator has the lowest precedence, in the table given below:

Operator Name Associativity
() Grouping
. Member left to right
[] Member left to right
new Create
() Function call left to right
++ Increment
-- Decrement
! Logical NOT
typeof Type
** Exponentiation right to left
* Multiplication left to right
/ Division
% Remainder/Modulus
+ Addition left to right
Subtraction
<< Left shift left to right
>> Right shift
>>> Unsigned Right shift
< Less than left to right
<= Less than or equal
> Greater than
>= Greater than or equal
in In
instanceof Instance of
== Equality left to right
!= Inequality
=== Strictly equal
!== Strictly unequal
& 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
+= Add then assign
-= Subtract then assign
*= Multiply then assign
/= Divide then assign
%= Modulus then assign
<<= left shift then assign
>>= right shift then assign
>>>= Unsigned right shift then assign
&= Logical AND then assign
^= Bitwise XOR then assign
|= Bitwise OR then assign
yield Pause function right to left
, Comma left to right

JavaScript Online Test


« Previous Tutorial Next Tutorial »