Operator precedence

An expression is evaluated in the order determined by operator precedence, and precedence is meaningful only if the expression includes multiple operators. The higher precedence operator is evaluated first. Operand grouping can be enforced by using parentheses.

Associativity rules are applied to the order of operation for operators that have the same precedence.

Precedence order, from highest to lowest, and associative are listed here:

Description Operators and syntactic elements Associativity

field access, optional chaining, non-null assertion,
function call

., =>, (), ?., !

left-to-right,
function call: n/a

unary, logical NOT

-, !

n/a

exponentiation

**

right-to-left

multiplication, division, modulo

*, /, %

left-to-right

addition, subtraction

+, -

left-to-right

bitwise AND

&

left-to-right

bitwise XOR

^

left-to-right

bitwise OR

|

left-to-right

is-a comparison

isa

left-to-right

comparison

>, <, >=, <=

left-to-right

equality

==, !=

left-to-right

logical AND

&&

left-to-right

logical OR

||

left-to-right

Null coalescing

??

left-to-right

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!