The operator precedence is an arrangement of operators in JavaScript. It decides the priority of the operators in a complex statement. In other words, it decides the order of the execution of operators in a complex statement. If a statement consists of more than one operator, the operators are used according to their priority defined in JavaScript.
The following table displays the operator precedence:
| () | Parentheses |
| [] | Braces |
| ! | Boolean NOT |
| ~ | Bitwise NOT |
| - | Negation |
| ++ | Increment |
| – | Decrement |
| typeof | typeof |
| void | void |
| delete | delete |
| * | Multiplication |
| / | Division |
| % | Modulus |
| + | Addition |
| - | Subtraction |
| << | Bitwise left shift |
| >> | Bitwise rightshift |
| >>> | Bitwise zero fill |
| < | Less than |
| <= | Less than or equal to |
| > | Greater than |
| >= | Greater than or equal to |
| == | Equal to (Comparison) |
| != | Not equal to |
| & | Bitwise AND |
| ^ | Bitwise XOR |
| | | Bitwise OR |
| && | Boolean AND |
| || | Boolean OR |
| ? | Conditional Operator |
| = | Equal to (Assignment) |
| *= | Multiply by value |
| /= | Divide by value |
| %= | Modulus by value |
| += | Add by value |
| - | Subtract by value |
| <<= | Left shift by value |
| >>= | Right shift by value |
| >>>= | Zero fill by value |
| &= | Bitwise AND by value |
| ^= | Bitwise XOR by value |
| |= | Bitwise OR by value |
| , | comma |