Operator Reference
| Precedence | Operators | Category |
|---|---|---|
| 1 | == != < > <= >= |
Comparison |
| 2 | + - |
Addition / subtraction |
| 3 | * / % // |
Multiplication / division |
| 4 | ** |
Exponentiation |
| 5 | unary operators | Unary |
| 6 | () [] |
Call / indexing |
Higher precedence binds more tightly.
For example:
let x = 2 + 3 * 4;
is evaluated as:
2 + (3 * 4)
Parentheses override normal precedence:
let x = (2 + 3) * 4;