The VIP Gate

EasyAcc. 93.5%
+20 XP 8

The Double Lock

For high-security operations, one key isn't enough. You need the Logical AND (&&) operator to ensure that both conditions are true at the same time. If even one condition is false, the entire door remains locked.

The Assignment

Your function receives parameters hasTicket and isLate.

  1. Use if-else with logical operators:
    • If the user hasTicket AND is NOT isLate, print: "Gate is open. Proceed."
    • Otherwise, print: "Entry denied."

01EXAMPLE 1

InputhasTicket = true, isLate = false
OutputLogs: "Gate is open. Proceed."

Explanation: Both conditions are met.

02EXAMPLE 2

InputhasTicket = true, isLate = true
OutputLogs: "Entry denied."

Explanation: Even with a ticket, the user is late.

Constraints

  • Use the && operator and the ! (NOT) operator.
  • Log messages must match exactly.
Control FlowConditionalsLogic
JavaScript
Loading...
4 Hidden

Input Arguments

hasTickettrue
isLatefalse

Expected Output

Gate is open. Proceed.

Click RUN to test your solution