Næste
Forrige
Oversigt
JavaScript "Core Language" serie, Planche nr. 19
Kursus Indhold

Logiske operatorer

Arbejder på boolske ("Boolean") udtryk:
Operator Usage Description

&&

expr1 && expr2

(Logical AND) Returns expr1 if it can be converted to false; otherwise, returns expr2. Thus, when used with Boolean values, && returns true if both operands are true; otherwise, returns false.

||

expr1 ||
expr2

(Logical OR) Returns expr1 if it can be converted to true; otherwise, returns expr2. Thus, when used with Boolean values, || returns true if either operand is true; if both are false, returns false.

!

!expr

(Logical NOT) Returns false if its single operand can be converted to true; otherwise, returns true.


© 1999 BLA*net - Leif E. Andersen, leander@blanet.dk