aboutsummaryrefslogtreecommitdiff
path: root/files/he/web/javascript/reference/operators/operator_precedence
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:45 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:45 -0500
commit1109132f09d75da9a28b649c7677bb6ce07c40c0 (patch)
tree0dd8b084480983cf9f9680e8aedb92782a921b13 /files/he/web/javascript/reference/operators/operator_precedence
parent4b1a9203c547c019fc5398082ae19a3f3d4c3efe (diff)
downloadtranslated-content-1109132f09d75da9a28b649c7677bb6ce07c40c0.tar.gz
translated-content-1109132f09d75da9a28b649c7677bb6ce07c40c0.tar.bz2
translated-content-1109132f09d75da9a28b649c7677bb6ce07c40c0.zip
initial commit
Diffstat (limited to 'files/he/web/javascript/reference/operators/operator_precedence')
-rw-r--r--files/he/web/javascript/reference/operators/operator_precedence/index.html330
1 files changed, 330 insertions, 0 deletions
diff --git a/files/he/web/javascript/reference/operators/operator_precedence/index.html b/files/he/web/javascript/reference/operators/operator_precedence/index.html
new file mode 100644
index 0000000000..2f22b36031
--- /dev/null
+++ b/files/he/web/javascript/reference/operators/operator_precedence/index.html
@@ -0,0 +1,330 @@
+---
+title: Operator precedence
+slug: Web/JavaScript/Reference/Operators/Operator_Precedence
+translation_of: Web/JavaScript/Reference/Operators/Operator_Precedence
+---
+<div dir="rtl">{{jsSidebar("Operators")}}</div>
+
+<p style="direction: rtl;">קדימות אופרטורים קובעת את הסדר שבו מעריכים את תוצאות האופרטורים. אופרטורים בעלי קדימות גבוהה יותר יוערכו ראשונים.</p>
+
+<p style="direction: rtl;">דוגמא נפוצה:</p>
+
+<pre class="brush: js">3 + 4 * 5 // מחזיר 23
+</pre>
+
+<p style="direction: rtl;">לאופרטור הכפל ("*") יש קדימות גבוהה יותר מאשר לאופרטור החיבור ("<code>+</code>") ולכן יוערך ראשון.</p>
+
+<h2 id="אסוציטיביות" style="direction: rtl;">אסוציטיביות</h2>
+
+<p dir="rtl">אסוציטיביות קובעת את הסדר שבו מעריכים אופרטורים בעלי קדימות זהה. למשל, חשבו על הביטוי הבא:</p>
+
+<pre class="syntaxbox" dir="rtl">a OP b OP c
+</pre>
+
+<p dir="rtl">אסוציטיביות שמאלית (משמאל לימין) פירושה שמעריכים (a OP b) OP c , ואסוציטיביות ימנית (מימין לשמאל) פירושה שמעריכים <code>a OP (b OP c)</code>. לאופרטורי השמה יש אסוציטיביות ימנית, אז אפשר לכתוב:</p>
+
+<pre class="brush: js" dir="rtl">a = b = 5;
+</pre>
+
+<p dir="rtl">ולצפות ש-a ו-b יקבלו את הערך 5. זאת משום שאופרטור ההשמה מחזיר את הערך שהושם. תחילה, הערך 5 מושם ל-b. אחר כך הערך של b מושם ל-a.</p>
+
+<h2 dir="rtl" id="טבלה">טבלה</h2>
+
+<p dir="rtl">הטבלה הבאה ממויינת לפי קדימות מהגבוה (19) לנמוך (0).</p>
+
+<table class="fullwidth-table" dir="rtl" style="text-align: right;">
+ <tbody>
+ <tr>
+ <th dir="ltr">אופרטור</th>
+ <th dir="ltr">אסוציטיביות</th>
+ <th dir="ltr">סוג האופרטור</th>
+ <th dir="ltr">קדימות</th>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>( … )</code></td>
+ <td dir="ltr">n/a</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Grouping">Grouping</a></td>
+ <td dir="ltr">19</td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… . …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_Accessors#Dot_notation">Member Access</a></td>
+ <td dir="ltr" rowspan="3">18</td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… [ … ]</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_Accessors#Dot_notation">Computed Member Access</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>new … ( … )</code></td>
+ <td dir="ltr">n/a</td>
+ <td dir="ltr"><a href="/en-US/docs/JavaScript/Reference/Operators/Special/new" title="JavaScript/Reference/Operators/Special_Operators/new_Operator">new</a> (עם רשימת ארכומנטים)</td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… ( <var>… </var>)</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Guide/Functions" title="JavaScript/Reference/Operators/Special_Operators/function_call">Function Call</a></td>
+ <td dir="ltr" rowspan="2">17</td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>new …</code></td>
+ <td dir="ltr">ימנית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/new" title="JavaScript/Reference/Operators/Special_Operators/new_Operator">new</a> (without argument list)</td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… ++</code></td>
+ <td dir="ltr">n/a</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Increment" title="JavaScript/Reference/Operators/Arithmetic_Operators">Postfix Increment</a></td>
+ <td dir="ltr" rowspan="2">16</td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… --</code></td>
+ <td dir="ltr">n/a</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Decrement" title="JavaScript/Reference/Operators/Arithmetic_Operators">Postfix Decrement</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>! …</code></td>
+ <td dir="ltr">ימנית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators#Logical_NOT" title="JavaScript/Reference/Operators/Logical_Operators">Logical NOT</a></td>
+ <td dir="ltr" rowspan="9">15</td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>~ …</code></td>
+ <td dir="ltr">ימנית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_NOT" title="JavaScript/Reference/Operators/Bitwise_Operators">Bitwise NOT</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>+ …</code></td>
+ <td dir="ltr">ימנית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Unary_plus" title="JavaScript/Reference/Operators/Arithmetic_Operators">Unary Plus</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>- …</code></td>
+ <td dir="ltr">ימנית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Unary_negation" title="JavaScript/Reference/Operators/Arithmetic_Operators">Unary Negation</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>++ …</code></td>
+ <td dir="ltr">ימנית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Increment" title="JavaScript/Reference/Operators/Arithmetic_Operators">Prefix Increment</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>-- …</code></td>
+ <td dir="ltr">ימנית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Decrement" title="JavaScript/Reference/Operators/Arithmetic_Operators">Prefix Decrement</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>typeof …</code></td>
+ <td dir="ltr">ימנית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/typeof" title="JavaScript/Reference/Operators/Special_Operators/typeof_Operator">typeof</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>void …</code></td>
+ <td dir="ltr">ימנית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/void" title="JavaScript/Reference/Operators/Special_Operators/void_Operator">void</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>delete …</code></td>
+ <td dir="ltr">ימנית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/delete" title="JavaScript/Reference/Operators/Special_Operators/delete_Operator">delete</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… ** …</code></td>
+ <td dir="ltr">ימנית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Exponentiation" title="JavaScript/Reference/Operators/Arithmetic_Operators">Exponentiation</a></td>
+ <td dir="ltr" rowspan="4">14</td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… * …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Multiplication" title="JavaScript/Reference/Operators/Arithmetic_Operators">Multiplication</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… / …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Division" title="JavaScript/Reference/Operators/Arithmetic_Operators">Division</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… % …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Remainder" title="JavaScript/Reference/Operators/Arithmetic_Operators">Remainder</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… + …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Addition" title="JavaScript/Reference/Operators/Arithmetic_Operators">Addition</a></td>
+ <td dir="ltr" rowspan="2">13</td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… - …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Subtraction" title="JavaScript/Reference/Operators/Arithmetic_Operators">Subtraction</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… &lt;&lt; …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators" title="JavaScript/Reference/Operators/Bitwise_Operators">Bitwise Left Shift</a></td>
+ <td dir="ltr" rowspan="3">12</td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… &gt;&gt; …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators" title="JavaScript/Reference/Operators/Bitwise_Operators">Bitwise Right Shift</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… &gt;&gt;&gt; …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators" title="JavaScript/Reference/Operators/Bitwise_Operators">Bitwise Unsigned Right Shift</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… &lt; …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Less_than_operator" title="JavaScript/Reference/Operators/Comparison_Operators">Less Than</a></td>
+ <td dir="ltr" rowspan="6">11</td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… &lt;= …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Less_than__or_equal_operator" title="JavaScript/Reference/Operators/Comparison_Operators">Less Than Or Equal</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… &gt; …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Greater_than_operator" title="JavaScript/Reference/Operators/Comparison_Operators">Greater Than</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… &gt;= …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Greater_than_or_equal_operator" title="JavaScript/Reference/Operators/Comparison_Operators">Greater Than Or Equal</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… in …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/in" title="JavaScript/Reference/Operators/Special_Operators/in_Operator">in</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… instanceof …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/instanceof" title="JavaScript/Reference/Operators/Special_Operators/instanceof_Operator">instanceof</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… == …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Equality" title="JavaScript/Reference/Operators/Comparison_Operators">Equality</a></td>
+ <td dir="ltr" rowspan="4">10</td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… != …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Inequality" title="JavaScript/Reference/Operators/Comparison_Operators">Inequality</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… === …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Identity" title="JavaScript/Reference/Operators/Comparison_Operators">Strict Equality</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… !== …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Nonidentity" title="JavaScript/Reference/Operators/Comparison_Operators">Strict Inequality</a></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… &amp; …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_AND" title="JavaScript/Reference/Operators/Bitwise_Operators">Bitwise AND</a></td>
+ <td dir="ltr">9</td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… ^ …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_XOR" title="JavaScript/Reference/Operators/Bitwise_Operators">Bitwise XOR</a></td>
+ <td dir="ltr">8</td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… | …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_OR" title="JavaScript/Reference/Operators/Bitwise_Operators">Bitwise OR</a></td>
+ <td dir="ltr">7</td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… &amp;&amp; …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators#Logical_AND" title="JavaScript/Reference/Operators/Logical_Operators">Logical AND</a></td>
+ <td dir="ltr">6</td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… || …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators#Logical_OR" title="JavaScript/Reference/Operators/Logical_Operators">Logical OR</a></td>
+ <td dir="ltr">5</td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… ? … : …</code></td>
+ <td dir="ltr">ימנית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator" title="JavaScript/Reference/Operators/Special_Operators/Conditional_Operator">Conditional</a></td>
+ <td dir="ltr">4</td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… = …</code></td>
+ <td dir="ltr" rowspan="13">ימנית</td>
+ <td dir="ltr" rowspan="13"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Assignment_Operators" title="JavaScript/Reference/Operators/Assignment_Operators">Assignment</a></td>
+ <td dir="ltr" rowspan="13">3</td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… += …</code></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… -= …</code></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… **= …</code></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… *= …</code></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… /= …</code></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… %= …</code></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… &lt;&lt;= …</code></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… &gt;&gt;= …</code></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… &gt;&gt;&gt;= …</code></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… &amp;= …</code></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… ^= …</code></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… |= …</code></td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>yield …</code></td>
+ <td dir="ltr">ימנית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/yield" title="JavaScript/Reference/Operators/yield">yield</a></td>
+ <td dir="ltr">2</td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>...</code> …</td>
+ <td dir="ltr">n/a</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator" title="JavaScript/Reference/Operators/Spread_operator">Spread</a></td>
+ <td dir="ltr">1</td>
+ </tr>
+ <tr>
+ <td dir="ltr"><code>… , …</code></td>
+ <td dir="ltr">שמאלית</td>
+ <td dir="ltr"><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Comma_Operator" title="JavaScript/Reference/Operators/Comma_Operator">Comma / Sequence</a></td>
+ <td dir="ltr">0</td>
+ </tr>
+ </tbody>
+</table>