Rate Password Strength

Write the code, see it run, pass the checks.

The problem

  • easy
  • Code

A password input labelled "Password" has a list under it, labelled "Password rules" (aria-label is fine), with four rules in this order: "At least 8 characters", "A number", "An uppercase letter" and "A symbol" (any character that isn't a letter from A to Z in either case, a digit or a space). Each list item reads the rule followed by ": met" or ": not met", e.g. "A number: met", and updates as you type. Below the list, show "Strength: weak" when 0 or 1 rules are met, "Strength: fair" for 2 or 3, and "Strength: strong" for all 4.

Your code must pass

  • Every rule starts not met and the strength is weak
  • Rules are marked met as you type
  • Two or three rules met is fair
  • All four rules met is strong
  • A space doesn't count as a symbol