In developer.mozilla website there are some examples to show different usage of logical OR operator, but this two examples got my attention, here they are :
o8 = '' || false // f || f returns false
o9 = false || '' // f || f returns ""
Why this two, return different results? I expected both of them return false.
See in the same page: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_OR
expr1 || expr2
If
expr1
can be converted totrue
, returnsexpr1
; else, returnsexpr2
.