Operators let you calculate values and compare them. Boolean logic lets you combine conditions so programs can make decisions.
const total = 12 + 8;
const difference = 20 - 5;
const doubled = 4 * 2;
const half = 10 / 2;
console.log(total > difference);
console.log(doubled === half);
console.log(total !== 25);
Use && when both conditions must be true, use
|| when either condition can be true, and use
! to reverse a boolean value.
const isLoggedIn = true;
const hasPaid = false;
console.log(isLoggedIn && hasPaid);
console.log(isLoggedIn || hasPaid);
console.log(!hasPaid);