JavaScript7 min read

JavaScript Logical Operators

Master logical operators. Learn &&, ||, ! and how they work with truthy/falsy values.

Alex Thompson
December 19, 2025
0.0k0

JavaScript Logical Operators

&& (AND)

Returns first falsy or last truthy:

true && false;  // false
true && 'hello'; // "hello"

|| (OR)

Returns first truthy or last falsy:

true || false;  // true
false || 'hello'; // "hello"

! (NOT)

Inverts boolean:

!true;   // false
!false;  // true

Key Takeaway

&& returns first falsy or last. || returns first truthy or last. ! inverts. Essential for conditionals.

#JavaScript#Operators#Logic#Beginner