Published on January 26, 2024By DeveloperBreeze

// Function to check if a password meets certain strength criteria
function isValidPassword(password) {
    // Customize validation rules as needed
    const minLength = 8;
    const hasUppercase = /[A-Z]/.test(password);
    const hasLowercase = /[a-z]/.test(password);
    const hasDigit = /\d/.test(password);

    // Check if the password meets the criteria
    return password.length >= minLength && hasUppercase && hasLowercase && hasDigit;
}

// Example password
const password = 'SecurePwd123';

// Log whether the password is valid to the console
console.log('Is Valid Password:', isValidPassword(password));

Comments

Please log in to leave a comment.

Continue Reading:

Generate Random Password

Published on January 26, 2024

javascriptpythonphp

Basic Authentication

Published on January 26, 2024

php

Detecting Browser and Version

Published on January 26, 2024

javascript

Detect Dark Mode Preference

Published on January 26, 2024

javascript

Calculate Greatest Common Divisor (GCD) of Two Numbers

Published on January 26, 2024

javascript

Calculate Distance Between Two Points

Published on January 26, 2024

javascript

Convert Array of Objects to CSV

Published on January 26, 2024

javascript

Parse JSON String to Object

Published on January 26, 2024

javascript

Python Regular Expressions (Regex) Cheatsheet

Published on August 03, 2024

python