This commit is contained in:
Ilya Kantor 2017-03-21 14:41:49 +03:00
parent 4ae129054e
commit ab9ab64bd5
476 changed files with 3370 additions and 532 deletions

View file

@ -0,0 +1,10 @@
The answer: `1`, and then `undefined`.
```js run
alert( alert(1) && alert(2) );
```
The call to `alert` returns `undefined` (it just shows a message, so there's no meaningful return).
Because of that, `&&` evaluates the left operand (outputs `1`), and immediately stops, because `undefined` is a falsy value. And `&&` looks for a falsy value and returns it, so it's done.