← Back to If Statements
Question 255
Password Strength Report
Password Strength Report
The array passwords holds several candidate passwords. For each one print<password>: <verdict>. The rules are checked in order and the first failure decides the verdict:too shortwhen the length is under 8;needs a digitwhen no character is between0and9;needs an uppercase letterwhen no character is betweenAandZ; otherwisestrong. Scan the characters with a for...of loop over the string and compare characters with>=and<=(string comparison works character by character). Use boolean flags to record what you found.
Expected Output:
abc: too short sunshineday: needs a digit sunshine7: needs an uppercase letter Sunshine7: strong
= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
If Statements
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (clog, fn, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.