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.
- Write an
if-elsestatement:- If the
password.lengthis less than 8, print: "Password is too short." - Otherwise, print: "Password accepted."
- If the
01EXAMPLE 1
Input
password = "abc1234"Output
Logs: "Password is too short."Explanation: Length is 7, which is < 8.
02EXAMPLE 2
Input
password = "secure_pass"Output
Logs: "Password accepted."Explanation: Length is 11, which is >= 8.
Constraints
- Use the .length property.
- Log messages must match exactly.
Control FlowConditionalsStrings
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
password"abc1234"
Expected Output
Password is too short.
Click RUN to test your solution