Course Content
Introduction to JavaScript
Now we will consider the logical operations. Logical operations are used between two boolean values.
Logical operators
There are 3 logical operators:
- AND (
&&
); - OR (
||
); - NOT (
!
).
AND
The AND (&&
) logical operator returns true
if two values equal true
:
The AND (&&
) operator requires that all values be true
in order to return true
.
OR
The OR (||
) logical operator returns true
if at least one value is true
:
NOT
The NOT (!
) operator inverts the value: not true
is false
; not false
is true
:
Using
Logical operations are used to combine some conditions. If you need to check that two values are greater than 4 (or 1), you should use the AND (&&
) operator:
Priority
Logical operations execute after comparison operations and comparison operations execute after math operations.

Note
Similar to other operations, you can use parentheses
()
to increase the priority of execution.
What will be the output?
Select the correct answer
What will be the output?
Select the correct answer
What will be the output?
Select the correct answer
Section 3.
Chapter 7