JavaScript Operators Reference

Every JS operator with precedence, associativity, types and examples

Interactive JavaScript operator reference covering arithmetic, comparison, logical, bitwise, assignment, and member-access operators. Each entry shows precedence level, associativity, and a worked example so you can predict how an expression evaluates.

What does operator precedence mean?

Precedence decides which operator binds first when an expression has several without parentheses. Multiplication has higher precedence than addition, so 2 + 3 * 4 evaluates the multiplication first and yields 14. Higher precedence numbers in the table bind tighter.

JavaScript has dozens of operators across several precedence levels, and a misread of which binds first is a classic source of bugs. This reference lists each operator with its precedence, associativity, and a worked example so you can predict exactly how an expression evaluates.

How it works

Every operator sits at a precedence level: when an expression has multiple operators without parentheses, the higher-precedence one is applied first. So 2 + 3 * 4 multiplies before adding because * outranks +.

When two operators share a precedence level, associativity breaks the tie. Most binary operators are left-associative, grouping left to right, so 10 - 4 - 2 is (10 - 4) - 2. Assignment, exponentiation (**), and the conditional ?: are right-associative, so a = b = c and 2 ** 3 ** 2 group from the right.

Tips and examples

A few precedence facts catch people out:

2 + 3 * 4        // 14, not 20
2 ** 3 ** 2      // 512 — right-associative, so 2 ** (3 ** 2)
true || false && false   // true — && binds tighter than ||
a ?? b || c      // SyntaxError — must parenthesize ?? with || or &&

When in doubt, add parentheses — they are free and make intent explicit. The nullish (??) and logical (||, &&) operators may not be mixed without parentheses by design, precisely because their precedence relationship surprised people.