Outline

The logical operator "and" (&&) is a way of saying you want to do something if one value AND another value are truthy. All comparisons in the statement must be truthy for the entire result to be truthy.

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 falsy value and returns that value, if there is a falsy value. If no falsy values are present, it continues to the end of the statement and returns the value of the last truthy statement as the result of the comparison.

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

truthy && truthy → truthy
truthy && falsy → falsy
falsy && truthy → falsy
falsy && falsy → falsy

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

 

I finished! On to the next chapter