Smart Password Strength Analyzer

by Vijay Pancholi

HTML

<input id="pwd" placeholder="Enter password">
<p id="strength"></p>

CSS

.glass {
  width: 300px;
  padding: 20px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  color: white;
}

JavaScript

pwd.oninput = () => {
  let score = 0;
  const v = pwd.value;

  if (v.length > 6) score++;
  if (/[A-Z]/.test(v)) score++;
  if (/[0-9]/.test(v)) score++;
  if (/[^A-Za-z0-9]/.test(v)) score++;

  strength.innerText =
    ["Weak", "Medium", "Strong", "Very Strong"][score-1] || "";
};