Precedence and Associativity

Precedence decides which operator binds first (3 + 4 * 5 is 23); associativity breaks ties within a level. **, assignment and ?: group right to left, so 2 ** 3 ** 2 is 512 and a = b = 2 assigns b first.

Operator precedence, condensed from MDN 102 's 18 levels
Level Operators (highest first) Associativity
18-16 ( ) grouping, . ?. [ ] calls, new left to right
15-14 x++ x--, prefix ! ~ + - ++ -- typeof void delete await n/a
13 ** right to left
12-11 * / %, then + - left to right
10-9 << >> >>>, then < <= > >= in instanceof left to right
8 == != === !== left to right
7-5 &, then ^, then | left to right
4-3 &&, then || and ?? left to right
2 = += ..., ? :, =>, yield, ... right to left
1 , left to right

Traps: 3 > 2 > 1 is false because true > 1 compares 1 > 1, and typeof 1 + 2 is "number2". Precedence never overrides short-circuiting: in a && (b + c) the group is skipped when a is falsy.