Labs ICT
Pro Login

Operator Precedence

1 min read | JavaScript Tutorial

Want the full learning experience?

Get structured courses, certificates, projects, and instructor support with LabsICT Pro.

Explore Pro Courses

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.