JS LOGICAL OPERATORS Flashcards
Logical Operators are used to return a True or False value based off of two boolean values (AKA True or False)
1
Q
AND
A
&& The AND logical operator checks if both values are true // Both values need to be true for the ending result to be true when using AND Ex: let andOne = true && false; equals false
2
Q
OR
A
||
The OR logical operator checks it at least ONE value is True
// Only one value needs to be true for the ending result to be true when using OR
Ex: let orOne = true || false; equals true
3
Q
Order of Operators
A
(AND before OR) // NOTE: Comparison Operators are completed before Logical Operators
4
Q
NOT
A
!
! is called a Bang in JavaScript
// The NOT logical operator converts the value from True to False if the value is True. Also, the NOT logical operator converts the value from False to True if the value is False.