Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Logical Operators in JavaScript.

1 . Logical AND ( && ) :- In this operator, it returns a TRUE value only when both the conditions are true else it returns FALSE. See the below image for understanding better.

Example :-
1. ( 5>2 ) && ( 6<8 ) – True
2. ( 5<2 ) && ( 5>3 ) – False
3. ( 5>2 ) && ( 5<3 ) – False
4. ( 5<2 ) && ( 5<3 ) – False

2 . Logical OR ( || ) :- In this operator, it returns a TRUE value if any Operand is true but, if both operands are false then it returns FALSE. See the below image for understanding better.

Example :-
1. ( 5>2 ) || ( 6<8 ) – True
2. ( 5<2 ) || ( 5>3 ) – True
3. ( 5>2 ) || ( 5<3 ) – True
4. ( 5<2 ) || ( 5<3 ) – False

3 . Logical NOT ( || ) :- In this operator, it returns a TRUE value if the condition is false and it returns FALSE if the condition is true. See the below image for understanding better.

Example :-
1. !( 5<2 ) – True
2. !( 5>2 ) – False

Video Reference