Logical Operators

👨‍💼 Sometimes we need to combine multiple conditions. Logical operators let us build complex conditions from simpler ones.
The logical operators are:
  • && AND - Both conditions must be true
  • || OR - At least one condition must be true
  • ! NOT - Flips true to false, false to true
🐨 Open and:
  1. Create variables: isLoggedIn = true, isAdmin = false, age = 25
  2. Log whether user is logged in AND is admin
  3. Log whether user is logged in OR is admin
  4. Log whether user is NOT logged in
  5. Log whether age is greater than 18 AND less than 65
💰 Examples:
console.log(true && true) // true
console.log(true && false) // false
console.log(true || false) // true
console.log(!true) // false

Please set the playground first

Loading "Logical Operators"
Loading "Logical Operators"

No tests here 😢 Sorry.