We use cookies.This website uses essential cookies to operate core features. With your consent, we also use analytics cookies to understand traffic and improve the service. For more details, see our .
Was this tool helpful to use?
Your feedback helps us make it better
Quickly check JavaScript operator precedence and associativity to avoid logic errors in your code.
Lower numbers mean higher precedence. This is a grouped syntax reference: ?? shares the || tier but cannot mix with ||/&& without parentheses. Precedence does not replace ECMAScript grammar constraints. Reference
( )Grouping ExpressionsNon-associative用括号显式改变表达式求值顺序,括号内先计算。
(a + b) * c.Member & CallLeft-associative访问对象的命名属性。
user.name[]Member & CallLeft-associative用表达式结果作为属性名或数组索引。
items[index]?.Member & CallLeft-associative对象为空值时短路返回 undefined,避免继续访问时报错。
user.profile?.email()Member & CallLeft-associative调用函数、方法或可调用表达式。
format(value)new ...()Member & CallLeft-associative创建构造函数实例,并传入参数列表。
new Date(2026, 0, 1)newObject CreationRight-associative创建构造函数实例;省略调用括号时优先级低于成员访问和函数调用。
new Datex++PostfixNon-associative返回变量当前值,然后将变量加 1。
count++x--PostfixNon-associative返回变量当前值,然后将变量减 1。
count--++xUnaryRight-associative先将变量加 1,再返回新值。
++count--xUnaryRight-associative先将变量减 1,再返回新值。
--count!UnaryRight-associative将值转换为布尔值后取反。
!isReady~UnaryRight-associative将操作数转为 32 位整数后逐位取反。
~mask+xUnaryRight-associative尝试将操作数转换为数字。
+inputValue-xUnaryRight-associative将操作数转换为数字后取相反数。
-pricetypeofUnaryRight-associative返回操作数类型的字符串描述。
typeof valuevoidUnaryRight-associative计算表达式并返回 undefined。
void fn()deleteUnaryRight-associative删除对象上的可配置属性。
delete user.tempawaitUnaryRight-associative在 async 函数或模块顶层等待 Promise 结果。
await fetchData()**ExponentiationRight-associative计算左操作数的右操作数次幂;左侧不能直接是一元表达式。
2 ** 3 ** 2*MultiplicativeLeft-associative两个数值相乘。
width * height/MultiplicativeLeft-associative左操作数除以右操作数。
total / count%MultiplicativeLeft-associative返回除法后的余数。
index % 2+AdditiveLeft-associative数值相加;任一操作数为字符串时通常执行字符串连接。
firstName + lastName-AdditiveLeft-associative两个数值相减。
end - start<<Bitwise ShiftLeft-associative将 32 位整数按位左移。
1 << bit>>Bitwise ShiftLeft-associative保留符号位进行右移。
value >> 1>>>Bitwise ShiftLeft-associative高位补 0 进行右移。
value >>> 1<RelationalLeft-associative比较左操作数是否小于右操作数。
age < 18<=RelationalLeft-associative比较左操作数是否小于或等于右操作数。
score <= 100>RelationalLeft-associative比较左操作数是否大于右操作数。
price > limit>=RelationalLeft-associative比较左操作数是否大于或等于右操作数。
count >= mininRelationalLeft-associative判断指定属性名是否存在于对象或其原型链中。
"name" in userinstanceofRelationalLeft-associative判断对象是否出现在构造函数的原型链上。
value instanceof Date==EqualityLeft-associative允许类型转换后比较两个值是否相等。
value == null!=EqualityLeft-associative允许类型转换后比较两个值是否不相等。
value != 0===EqualityLeft-associative不进行类型转换,比较类型和值是否都相同。
status === "ok"!==EqualityLeft-associative不进行类型转换,判断类型或值是否不同。
status !== "ok"&BitwiseLeft-associative两个 32 位整数逐位执行与运算。
flags & enabled^BitwiseLeft-associative两个 32 位整数逐位执行异或运算。
flags ^ mask|BitwiseLeft-associative两个 32 位整数逐位执行或运算。
flags | selected&&LogicalLeft-associative左侧为假值时短路返回左侧,否则返回右侧。
user && user.name||LogicalLeft-associative左侧为真值时短路返回左侧,否则返回右侧。
name || "匿名"??Nullish CoalescingLeft-associative左侧为 null 或 undefined 时返回右侧;与 &&、|| 混用时需要加括号。
count ?? 0?:Conditional (Ternary)Right-associative根据条件表达式结果在两个分支表达式中选择一个。
score >= 60 ? "通过" : "未通过"=AssignmentRight-associative将右侧表达式结果赋给左侧引用。
total = 0+=AssignmentRight-associative等价于把当前值与右侧值相加后再赋回。
total += price-=AssignmentRight-associative等价于把当前值减去右侧值后再赋回。
count -= 1*=AssignmentRight-associative等价于把当前值乘以右侧值后再赋回。
size *= 2/=AssignmentRight-associative等价于把当前值除以右侧值后再赋回。
size /= 2%=AssignmentRight-associative等价于把当前值取余后再赋回。
index %= length**=AssignmentRight-associative等价于对当前值执行幂运算后再赋回。
value **= 2<<=AssignmentRight-associative等价于左移后再赋回。
mask <<= 1>>=AssignmentRight-associative等价于有符号右移后再赋回。
mask >>= 1>>>=AssignmentRight-associative等价于无符号右移后再赋回。
mask >>>= 1&=AssignmentRight-associative等价于按位与后再赋回。
flags &= mask^=AssignmentRight-associative等价于按位异或后再赋回。
flags ^= mask|=AssignmentRight-associative等价于按位或后再赋回。
flags |= mask&&=AssignmentRight-associative左侧为真值时,才将右侧结果赋给左侧。
enabled &&= isAdmin||=AssignmentRight-associative左侧为假值时,才将右侧结果赋给左侧。
title ||= "未命名"??=AssignmentRight-associative左侧为 null 或 undefined 时,才将右侧结果赋给左侧。
options.timeout ??= 3000=>AssignmentRight-associative定义箭头函数表达式。
(x) => x * 2yieldAssignmentRight-associative在生成器函数中暂停执行并产出一个值。
yield valueyield*AssignmentRight-associative把产出过程委托给另一个可迭代对象。
yield* list,CommaLeft-associative从左到右依次求值,整个表达式结果为最后一个表达式。
(x += 1, x * 2)Overview
Understand what the tool solves, how it works, and the boundaries of its data.
Search the JavaScript operator directory by symbol, name, description, example text, or the directory's precedence number. You can narrow matches by operator category and associativity, then review each entry's description and code example.
Precedence describes how an expression is grouped when operators of different precedence appear together. For example, multiplication binds more tightly than addition, so a + b * c groups as a + (b * c). Associativity helps group operators at the same precedence, such as a = (b = 5) for chained assignment. Neither term is the same as a computed result.
The directory assigns lower numbers to higher precedence and groups entries by those local levels. These are convenient labels for browsing this directory, not the numeric scale used by every reference table. Compare the operator grouping and associativity in a language reference rather than equating numbers across sources.
Some symbols can serve different roles by position. For example, plus can be unary or binary, so inspect the entry and example that match your expression.
The search field filters directory records. It does not parse a full expression, execute JavaScript, inspect operand types, or report a runtime value. The displayed examples illustrate an operator entry and should not be treated as tests of your program.
Guide
Follow the workflow and verify inputs and outputs with practical examples.
Type a symbol such as ?? or ===, a name such as typeof, part of an example, or a level number.
Select a category such as logical, equality, or assignment. Add an associativity filter if you know whether you need left, right, or non-associative entries. Filters combine with the text search.
Check the symbol, category, associativity, short description, and example. Copy the symbol or example to use in your own editor.
If no entries remain, remove a filter or shorten the search term before concluding that an operator is absent.
Use cases
See how the tool fits into real work and everyday tasks.
Look up the operators in a dense condition, then add parentheses in your notes to make the grouping visible.
Use the entry as a shared reference in discussion, and test the actual expression with representative values.
Even when the language rules are clear, parentheses can make intent easier for a teammate to review.
Q&A
Find concise answers to common questions and confusing cases.
No. Search matches the directory; use a JavaScript runtime or test suite to evaluate a complete expression.
It determines grouping among operators at the same precedence. Different precedence levels determine grouping first; operand evaluation order is a separate rule.
No. They are the directory's ordering labels. Consult a current JavaScript reference for the language's precedence table and its caveats.
A symbol may have distinct forms or roles. Check each matching name and example against the position it occupies in your code.
Notes
Review scope, result limitations, and important precautions before use.
Precedence helps explain syntax, but program behavior can also depend on parentheses, operand values, short-circuiting, types, and side effects. When the result matters, test the whole expression with representative inputs and use parentheses where they clarify intent.
Related
Discover related tools, collections, and available API capabilities.