Recall & Review
beginner
What does the logical AND operator (&&) do in JavaScript?
The logical AND operator (&&) returns true if both values on its sides are true. If either side is false, it returns false.
Click to reveal answer
beginner
What is the result of
true || false in JavaScript?The result is
true because the logical OR operator (||) returns true if at least one side is true.Click to reveal answer
beginner
Explain the logical NOT operator (!) in JavaScript.
The logical NOT operator (!) reverses the truth value. If the value is true, it becomes false; if false, it becomes true.
Click to reveal answer
intermediate
What will
false && (anything) evaluate to and why?It will evaluate to
false immediately because with AND, if the first value is false, the whole expression is false without checking the second value.Click to reveal answer
intermediate
How does short-circuit evaluation work with logical OR (||)?
With OR (||), if the first value is true, JavaScript does not check the second value because the whole expression will be true anyway.
Click to reveal answer
What is the result of
true && false?✗ Incorrect
AND (&&) returns true only if both sides are true. Here, one side is false, so the result is false.
Which operator returns true if at least one operand is true?
✗ Incorrect
The OR operator (||) returns true if either operand is true.
What does the expression
!false evaluate to?✗ Incorrect
The NOT operator (!) reverses the value, so !false becomes true.
In
false && someFunction(), will someFunction() be called?✗ Incorrect
With AND, if the first value is false, JavaScript skips evaluating the second value (short-circuit).
What is the result of
true || false?✗ Incorrect
OR (||) returns true if at least one operand is true.
Explain how the logical AND (&&) and OR (||) operators work in JavaScript, including short-circuit behavior.
Think about when JavaScript stops checking the second value.
You got /3 concepts.
Describe the effect of the logical NOT (!) operator on a boolean value.
It flips the truth value.
You got /3 concepts.