Logical Operators
Combine multiple conditions with AND, OR, and NOT to build complex decision-making logic.
When one condition isn't enough
Real-world decisions rarely depend on a single yes-or-no question. To board a plane, you need a valid ticket AND a photo ID. To get a student discount, you must be under 25 OR have a student card. To enter a members-only area, you must NOT be on the banned list.
JavaScript gives you three **logical operators** to combine conditions:
- `&&` — **AND**: Are *both* conditions true?
- `||` — **OR**: Is *at least one* condition true?
- `!` — **NOT**: Flip true to false, or false to true.
These operators let you build sophisticated conditions inside a single `if` statement, instead of nesting multiple if/else blocks.
Logical operators in JavaScript follow the same truth table rules used in formal logic and every other programming language. If you learn AND, OR, NOT here, the concepts transfer directly to Python, Java, SQL, and beyond.