The Vault Entrance

EasyAcc. 98.1%
+15 XP 5

Measuring the Secret

Conditions aren't limited to numbers. You can use any data property—like the .length of a string—to trigger your logic. This is the foundation of data validation.

The Assignment

Your function receives a parameter named password.

  1. Write an if-else statement:
    • If the password.length is less than 8, print: "Password is too short."
    • Otherwise, print: "Password accepted."

01EXAMPLE 1

Inputpassword = "abc1234"
OutputLogs: "Password is too short."

Explanation: Length is 7, which is < 8.

02EXAMPLE 2

Inputpassword = "secure_pass"
OutputLogs: "Password accepted."

Explanation: Length is 11, which is >= 8.

Constraints

  • Use the .length property.
  • Log messages must match exactly.
Control FlowConditionalsStrings
JavaScript
Loading...
3 Hidden

Input Arguments

password"abc1234"

Expected Output

Password is too short.

Click RUN to test your solution