pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/Goudarz/javascript-tutorial-fa/commit/dad2d807de579dcb717d0214d673a798227eec83

media="all" rel="stylesheet" href="https://github.githubassets.com/assets/global-9c8f61f9f58ad7b2.css" /> fix precedence · Goudarz/javascript-tutorial-fa@dad2d80 · GitHub
Skip to content

Commit dad2d80

Browse files
committed
fix precedence
1 parent fab3cdb commit dad2d80

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

  • 1-js/02-first-steps/11-logical-operators

1-js/02-first-steps/11-logical-operators/article.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,10 @@ When all values are truthy, the last value is returned:
230230
alert( 1 && 2 && 3 ); // 3, the last one
231231
```
232232
233-
````smart header="AND `&&` executes before OR `||`"
234-
The precedence of the AND `&&` operator is higher than OR `||`, so it executes before OR.
233+
````smart header="Precedence of AND `&&` is higher than OR `||`"
234+
The precedence of AND `&&` operator is higher than OR `||`.
235235
236-
In the code below `1 && 0` is calculated first:
237-
238-
```js run
239-
alert( 5 || 1 && 0 ); // 5
240-
```
236+
So the code `a && b || c && d` is essentially the same as if `&&` were in parentheses: `(a && b) || (c && d)`.
241237
````
242238
243239
Just like OR, the AND `&&` operator can sometimes replace `if`.
@@ -303,3 +299,5 @@ There's a little more verbose way to do the same thing -- a built-in `Boolean` f
303299
alert( Boolean("non-empty string") ); // true
304300
alert( Boolean(null) ); // false
305301
```
302+
303+
The precedence of NOT `!` is the highest of all bitwise operators, so it always executes first, before any `&&`, `||`.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy