en.javascript.info/1-js/02-first-steps/11-logical-operators/4-alert-and/solution.md
Ilya Kantor ab9ab64bd5 up
2017-03-21 14:41:49 +03:00

376 B

The answer: 1, and then undefined.

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.