CKTIS / JavaScript
Logical AND operator (&&)
The && operator evaluates its left operand and evaluates the right operand only when the left is truthy. It returns one operand's value, which is not necessarily true or false.
Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
Syntax
left && rightThe expression left && right evaluates left first. If its value is false in a Boolean context (falsy), it returns that value without evaluating right. Otherwise, it evaluates and returns right. This is short-circuit evaluation: skipped function calls produce no side effects.
Falsy values include false, 0, -0, 0n, "", null, undefined, and NaN. Empty arrays and ordinary objects are true in a Boolean context (truthy). The result is not automatically converted to Boolean: 0 && "ready" produces 0, while "user" && "ready" produces "ready". Use Boolean(left && right) when you need a Boolean value.
A chain such as a && b && c stops at the first falsy value; if there is none, it returns the last value. The && operator has higher precedence than ||. Directly mixing && with ?? without parentheses is a syntax error; write (a && b) ?? c, for example.
Do not confuse && with bitwise & or the assignment operator &&=. The guard value && action() skips action() for 0 and "" too, not just for null or undefined. The operator itself does not assign anything to value.
Examples
let calls = 0;
function getLabel() {
calls += 1;
return "ready";
}
console.log(0 && getLabel());
console.log(true && getLabel());
console.log(calls);
console.log(Boolean("user" && "ready"));Result
0 ready 1 true
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.