Read a short-circuit expression
JavaScript’s && returns one of its operands. Trace which side is evaluated for a null user.
function isEnabled(user) {
return user && user.enabled;
}
Because user is falsy, the expression returns null without reading user.enabled.
What does isEnabled(null) return?
Why it matters: JavaScript logical operators return operands, which can differ from a strict boolean.