JavaScript » Logical » &&

This is the logical AND operator, which returns a Boolean true if both the operands are true. Logically it follows that if the first operand is false, then the whole expression is false, and this is how the operator works; It first evaluates the left hand operand, and if this returns false then, without going any further, it returns false for the whole expression. Otherwise it returns the value of the second operand: true or false for a Boolean value, or the actual value itself if non-Boolean.

Examples

Code:
if((a == c) && (b == 5))
x = "bread" && (c == 3)
Explanation:

Assuming 'a' to be 3, 'b' to be 5, and 'c' to be 3, these examples all return true.

Code:
x = (b > c) && "cheese"
x = "bread" && "cheese"
Explanation:

These examples return cheese.