Logical Operators in JavaScript

Logical operators are used to evaluate resultant of 2 or more boolean values (conditions).

OperatorOperationDescription
“&&”andResultant of ‘and’ operation is ‘true’ when all the conditions are ‘true’.
“||”orResultant of ‘or’ operation is ‘true’ when any of the conditions is ‘true’.
“!”notInverts ‘true’ to ‘false’ and vice versa.

Comparison Operators in JavaScript

Comparison operators are used to evaluate if 2 operands are equal, not equal, greater than, less than etc.

OperatorOperationDescription
“==”EqualReturns ‘true’ when operand values are equal.
“===”Strict EqualReturns ‘true’ when operands value and type are equal.
“!=”Not EqualReturns ‘true’ when operands values are not equal.
“!==”Strict Not EqualReturns ‘true’ operands value and/or type are not equal.
“>”Greater ThanReturns ‘true’ when left operand is greater than the right operand.
“<"Less ThanReturns ‘true’ when left operand is less than the right operand.
“>=”Greater Than or EqualReturns ‘true’ when left operand is greater than or equal to the right operand.
“<="Less Than or EqualReturns ‘true’ when left operand is less than or equal to the right operand.