Binary logical operator (Definition)

An operator that works with Boolean true or false values.


ECMAScript edition - 2
Property/method value type:Boolean primitive

Binary logical operators test a pair of Boolean values according to logical rules. If necessary, JavaScript will convert the operands that are passed to the expression into a Boolean value before testing them. You should consult the toBoolean rules for each type of object being passed to ensure that values are cast in a way that you expect.

The resulting value of a binary logical expression may be coerced to another data type on return.

There is no logical XOR operator. It can be simulated though by testing two Boolean values for inequality, since that is going to occur when either is one and the other is zero; the inequality will not test true if both are one or both are zero.


See also:Logical AND (&&), Logical operator, Logical OR (||)


ECMA 262 edition 2 - section - 11.11

ECMA 262 edition 3 - section - 11.11