JS Daily #10 - Logical OR

What is the output of following code?

const result = false || "Hello";

Output is "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 true. Therefore "Hello" is returned and assigned to result.

If all the values in the logical OR statement is falsy, then result will be false.