Tool8Tool8

Operator Precedence Table

Comprehensive operator precedence tables for popular programming languages. Understand the order of operations to write better code.

Select Programming Language
Choose a programming language to view its operator precedence table
JavaScript Operator Precedence
Higher precedence operators are evaluated first. Click on any operator or example to copy it.
Precedence
Operator
Associativity
Description
Example
20
Left-to-right
Grouping
19
Left-to-right
Member access
19
Left-to-right
Computed member access
19
Right-to-left
Constructor call
18
Right-to-left
Prefix increment
18
Right-to-left
Prefix decrement
18
Right-to-left
Logical NOT
18
Right-to-left
Bitwise NOT
17
Right-to-left
Exponentiation
16
Left-to-right
Multiplication
16
Left-to-right
Division
16
Left-to-right
Remainder
15
Left-to-right
Addition
15
Left-to-right
Subtraction
14
Left-to-right
Left shift
14
Left-to-right
Right shift
13
Left-to-right
Less than
13
Left-to-right
Less than or equal
13
Left-to-right
Greater than
13
Left-to-right
Greater than or equal
12
Left-to-right
Equality
12
Left-to-right
Inequality
12
Left-to-right
Strict equality
12
Left-to-right
Strict inequality
11
Left-to-right
Bitwise AND
10
Left-to-right
Bitwise XOR
9
Left-to-right
Bitwise OR
8
Left-to-right
Logical AND
7
Left-to-right
Logical OR
5
Right-to-left
Conditional
4
Right-to-left
Assignment
4
Right-to-left
Addition assignment
3
Left-to-right
Comma operator
Understanding Operator Precedence

What is Operator Precedence?

Operator precedence determines the order in which operators are evaluated in an expression. Operators with higher precedence are evaluated before operators with lower precedence.

Associativity

  • Left-to-right: Operations of equal precedence are evaluated from left to right
  • Right-to-left: Operations of equal precedence are evaluated from right to left

Example (JavaScript)

a + b * c → a + (b * c) because * has higher precedence than +

Tips

  • • Use parentheses to make your intentions clear
  • • Don't rely solely on precedence for complex expressions
  • • Different languages may have different precedence rules
  • • When in doubt, use parentheses to group operations explicitly