ترجیح علامتگذارهای JavaScript
- صفحه قبل علامتهای محاسباتی JS
- صفحه بعدی جملات JS
Precedence describes the execution order of operations in arithmetic expressions.
instance
In traditional mathematics, multiplication is executed first:
let x = 100 + 50 * 3;
When using parentheses, the operation inside the parentheses is calculated first:
let x = (100 + 50) * 3;
When operators have the same precedence (such as + and -), they are calculated from left to right:
let x = 100 / 50 * 3;
operator precedence valueexpression inside parenthesesقبل ازother expressions calculation. function used in the result for other expressionsbeforeاجراء. |
|||
value | operator | description | example |
---|---|---|---|
43 | ( ) | expression grouping | (100 + 50) * 3 |
17 | . | member | car.name |
17 | [] | member | car["name"] |
17 | ?. | optional chaining ES2020 | x ?. y |
17 | () | function call | myFunction() |
17 | new | parameterized construction | new Date("June 6,2025") |
16 | new | no parameter construction | new Date() |
increment operatorpostfix incrementقبل ازprefix increment execution. |
|||
15 | ++ | postfix increment | i++ |
15 | -- | postfix decrement | i-- |
14 | ++ | prefix increment | ++i |
14 | -- | prefix decrement | --i |
NOT operator |
|||
14 | ! | logical NOT | !(x==y) |
14 | ~ | NOT | ~x |
عملگر یکگانه |
|||
14 | + | افزایش یکگانه | +x |
14 | - | کاهش یکگانه | -x |
14 | typeof | نوع داده | typeof x |
14 | void | مقدار خالی Void | void(0) |
14 | delete | حذف ویژگی | delete myCar.color |
عملگر حسابداریمضربقبل ازاجراء ضرب. تقسیم و ضربقبل ازاجراء افزایش و کاهش. |
|||
13 | ** | مضرب ES2016 | 10 ** 2 |
12 | * | تقسیم | 10 * 5 |
12 | / | تقسیم | 10 / 5 |
12 | % | جابجایی باقیمانده | 10 % 5 |
11 | + | افزایش | 10 + 5 |
11 | - | کاهش | 10 - 5 |
11 | + | ادغام | "Bill" + "Gates" |
عملگر جابجایی |
|||
10 | << | جابجایی به چپ | x << 2 |
10 | >> | جابجایی به راست (با سیگنال) | x >> 2 |
10 | >>> | جابجایی به راست (بیسیگنال) | x >>> 2 |
عملگر رابطه |
|||
9 | in | ویژگی در اشیاء | "PI" in Math |
9 | instanceof | مثال对象的 | x instanceof Array |
عملگر مقایسه |
|||
9 | < | کوچکتر | x < y |
9 | <= | کوچکتر یا مساوی | x <= y |
9 | > | بزرگتر | x > y |
9 | >= | بزرگتر یا مساوی | x >= Array |
8 | == | ابرابر | x == y |
8 | === | ابرابر سخت | x === y |
8 | != | ناابرابر | x != y |
8 | !== | ناابرابر سخت | x !== y |
عملگر بیت |
|||
7 | & | AND بیت | x & y |
6 | ^ | XOR بیت | x ^ y |
5 | | | و بیت | x | y |
عملگر منطقی |
|||
4 | && | و منطقی | x && y |
3 | || | و منطقی | x || y |
3 | ?? | ادغام مقادیر خالی ES2020 | x ?? y |
عملگر شرطی (سهگانه) |
|||
2 | ? : | شرطی | ? "بله" : "خیر" |
运算符 تخصیصتخصیص در عملیات دیگربعد ازاجراء. |
|||
2 | = | تخصیص ساده | x = y |
2 | += | افزایش تخصیص | x += y |
2 | -= | کاهش تخصیص | x -= y |
2 | *= | تقسیم تخصیص | x *= y |
2 | **= | مضرب تخصیص | x **= y |
2 | /= | تقسیم تخصیص | x /= y |
2 | %= | جابجایی باقیمانده تخصیص | x %= y |
2 | <<= | جابجایی به چپ تخصیص | x <<= y |
2 | >>= | جابجایی به راست تخصیص | x >>= y |
2 | >>= | جابجایی به راست (بیسیگنال) | x >>>= y |
2 | &= | بیتAND تخصیص | x &= y |
2 | |= | موقعیت یا تخصیص | x |= y |
2 | ^= | تخصیص XOR بیتای | x ^= y |
2 | &= | تخصیص منطقی AND | x &= y |
2 | ||= | تخصیص منطقی OR | x ||= y |
2 | : | تخصیص با کاما | x : 5 |
2 | => | پیکان | x => y |
2 | yield | توقف/بازگشت | yield x |
2 | yield* | پایاندهی | yield* x |
2 | ... | گسترش | ...x |
1 | , | کاما | x , y |
- صفحه قبل علامتهای محاسباتی JS
- صفحه بعدی جملات JS