[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Operators/Operator_precedence [Back]  [Original]

- JavaScript | MDN

MDN Web Docs

View in English Always switch to English

Operator precedenceoperands

In this article

console.log(3 + 4 * 5); // 3 + 20
// Expected output: 23

console.log(4 * 3 ** 2); // 4 * 9
// Expected output: 36

let a;
let b;

console.log((a = b = 5));
// Expected output: 5

(Associativity)

a OP b OP c

(Left-associativity) (a OP b) OP c(right-associativity) a OP (b OP c) (Assignment operators)

js
a = b = 5;

a b 5 (Assignment operator) b 5 a 5

(Table)

(19) (1)


Precedence

Operator type

Associativity

Individual operators
19 Grouping ( )
18 Member Access .
Computed Member Access [ ]
new (with argument list) new ( )
( )
Optional chaining ?.
17 new (without argument list) new
16 ++
--
15 Logical NOT !
Bitwise NOT ~
Unary Plus +
Unary Negation -
++
--
typeof typeof
void void
delete delete
await await
14 Exponentiation **
13 Multiplication *
Division /
Remainder %
12 Addition +
Subtraction -
11 Bitwise Left Shift <<
Bitwise Right Shift >>
Bitwise Unsigned Right Shift >>>
10 Less Than <
Less Than Or Equal <=
Greater Than >
Greater Than Or Equal >=
in in
instanceof instanceof
9 Equality ==
Inequality !=
Strict Equality ===
Strict Inequality !==
8 Bitwise AND &
7 Bitwise XOR ^
6 Bitwise OR |
5 Logical AND &&
4 Logical OR ||
Nullish Coalescing ??
3 ? :
2 =
+=
-=
**=
*=
/=
%=
<<=
>>=
>>>=
&=
^=
|=
&&=
||=
??=
1 Comma / Sequence ,

Web Proxy Viewer  |  New URL  |  Original Page