JS Daily #10 - Logical OR
What is the output of following code?
const result = false || "Hello"; console.log(result);
"Hello". Output is not
true as in some other programming languages.
Logical OR operator returns the deciding value in the logical chain. Here, the first value is
false. So, the OR operator needs to check the next value. The next value,
"Hello" is a truthy value that makes the overall OR statement
"Hello" is returned and assigned to
If all the values in the logical OR statement is falsy, then
result will be