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.
- Check if the
ageis strictly greater than 21. - Check if
hasIDis true. - Return the result of combining both with the
&&operator.
01EXAMPLE 1
Input
age = 25, hasID = trueOutput
trueExplanation: Both age > 21 and hasID are true.
Constraints
- Use the && operator.
- Take advantage of short-circuiting logic.
FundamentalsLogicOperators
JavaScriptSystem handles I/O — write your function only
Loading...
9 Hidden
Input Arguments
age25
hasIDtrue
Expected Output
true
Click RUN to test your solution