We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Logical Operators

In Python, the logical operators are simply their English names:

  • and
  • or
  • not

In JavaScript, the equivalent logical operators use symbols:

  • && (and) - Returns true if both conditions are true
  • || (or) - Returns true if either of the conditions are true
  • ! (not) - Returns true only if the input is false
true && true; // true
true && false; // false
true || false; // true
false || false; // false
!false; // true
!true; // false

This syntax matches many other languages like Go, Rust, and C.

Assignment

Textio needs to determine whether an SMS campaign is considered "high-engagement".

A campaign qualifies as having high-engagement if it meets the following criteria:

  • It has a high open rate
  • It is a recent campaign
  • It either has a strong reply rate or can be sent again
  • It is not flagged as spam

Set the isHighEngagement variable using the given conditions and the appropriate logical operators. Remember that you can specify an "order of operations" by using parentheses.