Open
Description
In What about &&? section we have the following code.
function foo() {
console.log( a );
}
var a = 42;
a && foo(); // 42
result in comment should indicate that foo was called. but in fact we would get same result of "42" if first operand had been called (like in ||
operator). i think results of a
and foo()
should be different to make the example be clearer.
for example:
function foo() {
console.log("foo");
}
var a = 42;
a && foo(); // "foo"