In this table, the column labeled "P" gives the operator precedence and the column labeled "A" gives the operator associativity, which can be L (left-to-right) or R (right-to-left). If you do not already understand precedence and associativity, the subsections that follow the table explain these concepts. The operators themselves are documented following that discussion.
P |
A |
Operator |
Operand type(s) |
Operation performed |
---|---|---|---|---|
15 |
L |
. |
object, identifier |
Property access |
L |
[] |
array, integer |
Array index |
|
L |
( ) |
function, arguments |
Function call |
|
R |
new |
constructor call |
Create new object |
|
14 |
R |
++ |
lvalue |
Pre- or post-increment (unary) |
R |
-- |
lvalue |
Pre- or post-decrement (unary) |
|
R |
- |
number |
Unary minus (negation) |
|
R |
+ |
number |
Unary plus (no-op) |
|
R |
~ |
integer |
Bitwise complement (unary) |
|
R |
! |
boolean |
Logical complement (unary) |
|
R |
delete |
lvalue |
Undefine a property (unary) |
|
R |
typeof |
any |
Return data type (unary) |
|
R |
void |
any |
Return undefined value (unary) |
|
13 |
L |
*, /, % |
numbers |
Multiplication, division, remainder |
12 |
L |
+, - |
numbers |
Addition, subtraction |
L |
+ |
strings |
String concatenation |
|
11 |
L |
<< |
integers |
Left shift |
L |
>> |
integers |
Right shift with sign-extension |
|
L |
>>> |
integers |
Right shift with zero extension |
|
10 |
L |
<, <= |
numbers or strings |
Less than, less than or equal |
L |
>, >= |
numbers or strings |
Greater than, greater than or equal |
|
L |
instanceof |
object, constructor |
Check object type |
|
L |
in |
string, object |
Check whether property exists |
|
9 |
L |
== |
any |
Test for equality |
L |
!= |
any |
Test for inequality |
|
L |
=== |
any |
Test for identity |
|
L |
!== |
any |
Test for non-identity |
|
8 |
L |
& |
integers |
Bitwise AND |
7 |
L |
^ |
integers |
Bitwise XOR |
6 |
L |
| |
integers |
Bitwise OR |
5 |
L |
&& |
booleans |
Logical AND |
4 |
L |
|| |
booleans |
Logical OR |
3 |
R |
?: |
boolean, any, any |
Conditional operator (3 operands) |
2 |
R |
= |
lvalue, any |
Assignment |
R |
*=, /=, %=, +=, -=, <<=, >>=, >>>=, &=, ^=, |= |
lvalue, any |
Assignment with operation |
|
1 |
L |
, |
any |
Multiple evaluation |