DeveloperBreeze

Validate Password Strength

// 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));

Related Posts

More content you might like

Tutorial
javascript

Running JavaScript in the Browser Console

  • Write multi-line code directly in the console:
     function greet(name) {
       return `Hello, ${name}!`;
     }
     greet("Alice");

Dec 10, 2024
Read More
Tutorial
python

Understanding Regular Expressions with `re` in Python

import re

# Pattern to match floating-point numbers
pattern = r"[+-]?\d+(\.\d+)?"

# Example text containing floating-point numbers
text = "Temperatures range from -3.5 to +27.85 degrees."

matches = re.findall(pattern, text)
print(matches)  # Output: ['-3.5', '+27.85']
  • The pattern r"[+-]?\d+(\.\d+)?" matches numbers like -3.5 and +27.85. It can handle both signed and unsigned numbers with a decimal point.

Oct 24, 2024
Read More
Tutorial
bash

How to Create SSL for a Website on Ubuntu

sudo certbot --nginx

You’ll be prompted to:

Oct 21, 2024
Read More
Tutorial
javascript

Mastering console.log Advanced Usages and Techniques

function functionA() {
  functionB();
}

function functionB() {
  console.trace('Trace');
}

functionA();
// Output:
// Trace
//     at functionB (<anonymous>:6:11)
//     at functionA (<anonymous>:2:3)
//     at <anonymous>:9:1

In addition to console.log, JavaScript provides other logging methods like console.info, console.warn, and console.error. These methods log messages with different levels of severity, which can be visually distinguished in the console.

Sep 02, 2024
Read More

Discussion 0

Please sign in to join the discussion.

No comments yet. Be the first to share your thoughts!