20 ms·
> which isn't even the same since it returns `false` if something is null That's not the case AFAIK - checking in both node and FireFox, `true && null` evalute
by benaiah 8y ago
> which isn't even the same since it returns `false` if something is null
That's not the case AFAIK - checking in both node and FireFox, `true && null` evalutes to `null`, `true && undefined` evaluates to `undefined`, and `true && null && true` again evaluates to `null`. In what scenario does `&&` coerce the returned value to a boolean?
EDIT: checked MDN's docs at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_Operators https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... - it seems to indicate that there is no such coercion of falsy values to false.
- schneidmaster 8y agoYeah, you're right, I was misremembering the behaviour of `null && null`. At any rate, still clunkier :)