The AND Operator

EasyAcc. 94.2%
+30 XP 10

Security Clearance

Access to the mainframe requires multiple verified credentials. The Logical AND (&&) operator only returns true if both inputs are true.

  1. Check if the age is strictly greater than 21.
  2. Check if hasID is true.
  3. Return the result of combining both with the && operator.

01EXAMPLE 1

Inputage = 25, hasID = true
Outputtrue

Explanation: Both age > 21 and hasID are true.

Constraints

  • Use the && operator.
  • Take advantage of short-circuiting logic.
FundamentalsLogicOperators
JavaScript
Loading...
9 Hidden

Input Arguments

age25
hasIDtrue

Expected Output

true

Click RUN to test your solution