JavaScript Editor Ajax toolkit     Ajax website 

Main Page

Operator precedence is a set of rules in JScript that controls the order in which the compiler performs operations when evaluating an expression. Operations with a higher precedence are performed before those with a lower one. For example, multiplication is performed before addition.

Precedence Table

The following table lists the JScript operators, ordered from highest to lowest precedence.

Precedence Evaluation Order Operator Description


left to right

., [], ()

Field access, array indexing, function calls, and expression grouping


right to left

++, --, -, ~, !, delete, new, typeof, void

Unary operators, return data type, object creation, undefined values


left to right

*, /, %

Multiplication, division, modulo division


left to right

+, -

Addition and string concatenation, subtraction


left to right

<<, >>, >>>

Bit shifting


left to right

<, <=, >, >=, instanceof

Less than, less than or equal, greater than, greater than or equal, instanceof


left to right

==, !=, ===, !==

Equality, inequality, strict equality, and strict inequality


left to right


Bitwise AND


left to right


Bitwise XOR


left to right


Bitwise OR


left to right


Logical AND


left to right


Logical OR


right to left




right to left

=, OP=

Assignment, compound assignment


left to right

, (comma)

Multiple evaluation

Parentheses in an expression alter the order of evaluation determined by operator precedence. This means that an expression within parentheses is fully evaluated before its value is used in the remainder of the expression.

For example:

В CopyCode imageCopy Code
z = 78 * (96 - 3 + 45)

There are five operators in the preceding expression: =, *, (), -, and +. According to the rules of operator precedence, they are evaluated in the following order: (), -, +, *, =.

  1. Evaluation of the expression within the parentheses occurs first. Within the parentheses, there is an addition operator and a subtraction operator. The operators both have the same precedence, and they are evaluated from left to right. The number 3 is subtracted from 96 first, resulting in 93. Then the number 45 is added to 93, resulting in a value of 139.

  2. Multiplication occurs next. The number 78 is multiplied by the number 139, resulting in a value of 10764.

  3. Assignment occurs last. The number 10764 is assigned to z.

See Also


Operator Summary

Other Resources

JScript Operators

JavaScript Editor Ajax toolkit     Ajax website