Logical Operators

George Boole

Logical operators are also called Boolean operators after George Boole, an English mathematician and logician. The results of Boolean operations are either TRUE or FALSE.

Boolean operators are used to establish a relationship between two operands.

Key logical operators used in JavaScript are: AND – OR – NOT

Example: Assume that the variable Number1 = 9 and that Number2 = 4

Operator Description Expresssion Output
&& AND (Number1 < 10 && Number2 > 1) TRUE
|| OR (Number1 == 5 || Number2 == 5) FALSE
! NOT !(Number1 == Number2) TRUE

All logical and arithmetic operations are carried out by a computers ALU, which is short for Arithmetic and Logic Unit. The ALU is a vital part of the computer’s CPU (Central Processing Unit). All computer systems work using the binary number system and in order to carry out their operations they make use of logic gates. The CPU contains many logic gates that are set up to allow complex binary manipulations.

Name Logic Gate
AND AND Logic Gate
OR OR Logic Gate
NOT NOT Logic Gate

Next: Logical Operator Quiz