Operator precedence describes the order in which operations are performed in an arithmetic expression.
Multiplication (*
) and division (/
) have higher precedence than addition (+
) and subtraction (-
).
As in traditional mathematics, multiplication is done first:
let x = 100 + 50 * 3;
When using parentheses, operations inside the parentheses are computed first :
let x = (100 + 50) * 3;
Operations with the same precedence (like * and /) are computed from left to right : Continue reading JavaScript Operator Precedence