Outline

The logical operator "or" (||) is a way of saying you want to use one value OR another value. As long as one value is truthy, you're happy and will do something with that value.

When evaluating an expression that uses the || operator, JavaScript starts at the left most part of the expression and works its way to the right. It stops at the first truthy value and returns that value to be used. If no truthy values are available, it returns the last falsy value in the list.

Here's a table of when an expression table will result in what value given two comparisons:

truthy || truthy → truthy
truthy || falsy → truthy
falsy || truthy → truthy
falsy || falsy → falsy

For more information on the logical or operator, read this blog post.

 

I finished! On to the next chapter