Priority | Operator | Description | Example |
---|---|---|---|
1 | ( ) | Expression grouping | (3 + 4) |
2 | . | Member | person.name |
2 | [] | Member | person["name"] |
3 | () | Function call | myFunction() |
3 | new | Create | new Date() |
4 | ++ | Postfix Increment | i++ |
4 | -- | Postfix Decrement | i-- |
5 | ++ | Prefix Increment | ++i |
5 | -- | Prefix Decrement | --i |
5 | ! | Logical not | !(x==y) |
5 | typeof | Type | typeof x |
6 | * | Multiplication | 10 * 5 |
6 | / | Division | 10 / 5 |
6 | % | Modulo division | 10 % 5 |
6 | ** | Exponentiation | 10 ** 2 |
7 | + | Addition | 10 + 5 |
7 | - | Subtraction | 10 - 5 |
8 | << | Shift left | x << 2 |
8 | >> | Shift right | x >> 2 |
9 | < | Less than | x < y |
9 | <= | Less than or equal | x <= y |
9 | > | Greater than | x > y |
9 | >= | Greater than or equal | x >= y |
10 | == | Equal | x == y |
10 | === | Strict equal | x === y |
10 | != | Unequal | x != y |
10 | !== | Strict unequal | x !== y |
11 | && | And | x && y |
12 | || | Or | x || y |
13 | = | Assignment | x = y |
13 | += | Assignment | x += y |
13 | -= | Assignment | x -= y |
13 | *= | Assignment | x *= y |
13 | /= | Assignment | x /= y |
Top priority goes to expressions in parentheses which are fully computed before the value is used in the rest of the expression.