Labs ICT
🎓 SIWES/IT Login

Operator Precedence

1 min read | JavaScript Tutorial
🎓

Doing SIWES / IT attachment?

Get a structured training programme, a supervised digital logbook, and a completion certificate with LabsICT SIWES / IT.

Explore SIWES / IT Training

Operator Precedence

When an expression has multiple operators, JavaScript follows a strict order of operations — just like in math. Multiplication happens before addition. Parentheses override everything.

Here's a simplified precedence table (highest to lowest):

  • () — Grouping
  • ., [], () — Member access, call
  • !, ~, ++, -- — Unary
  • **, *, /, % — Multiplicative
  • +, - — Additive
  • <, >, <=, >= — Relational
  • ==, ===, !=, !== — Equality
  • && — Logical AND
  • || — Logical OR
  • ?? — Nullish coalescing
  • =, +=, etc. — Assignment
console.log(2 + 3 * 4);
console.log((2 + 3) * 4);
console.log(2 ** 3 + 1);
console.log(2 ** (3 + 1));

When in doubt, add parentheses. They make your intent clear to both JavaScript and your fellow developers.