up
This commit is contained in:
parent
4ae129054e
commit
ab9ab64bd5
476 changed files with 3370 additions and 532 deletions
|
@ -0,0 +1,20 @@
|
|||
The answer: the first and the third will execute.
|
||||
|
||||
Details:
|
||||
|
||||
```js run
|
||||
// Runs.
|
||||
// The result of -1 || 0 = -1, truthy
|
||||
if (-1 || 0) alert( 'first' );
|
||||
|
||||
// Doesn't run
|
||||
// -1 && 0 = 0, falsy
|
||||
if (-1 && 0) alert( 'second' );
|
||||
|
||||
// Executes
|
||||
// Operator && has a higher precedence than ||
|
||||
// so -1 && 1 executes first, giving us the chain:
|
||||
// null || -1 && 1 -> null || 1 -> 1
|
||||
if (null || -1 && 1) alert( 'third' );
|
||||
```
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue