The Continental Guard

EasyAcc. 94.8%
+20 XP 8

Simplified Gatekeeping

Sometimes, multiple keys can open the same door. Instead of writing two separate if statements, we use the Logical OR (||) to check if either one of the conditions is true.

The Assignment

Your function receives a parameter named country.

  1. Build a border check using if-else:
    • If the country is "USA" OR "Canada", print: "North American"
    • Otherwise, print: "Other region"

01EXAMPLE 1

Inputcountry = "Canada"
OutputLogs: "North American"

Explanation: Canada is one of the valid states.

02EXAMPLE 2

Inputcountry = "France"
OutputLogs: "Other region"

Explanation: France matches neither condition.

Constraints

  • Use the || operator inside your if condition.
  • Log messages must match exactly.
Control FlowConditionalsLogic
JavaScript
Loading...
4 Hidden

Input Arguments

country"Canada"

Expected Output

North American

Click RUN to test your solution