// 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));Validate Password Strength
Related Posts
More content you might like
Tutorial
javascript
Running JavaScript in the Browser Console
- Select an element on the webpage and access it in the console using
$0:
$0.style.color = "red";Dec 10, 2024
Read More Tutorial
python
Understanding Regular Expressions with `re` in Python
[+-]?: Match an optional+or-sign.\d+: Match one or more digits.(\.\d+)?: Match an optional decimal point followed by one or more digits (for floating-point numbers).
Let's first create a pattern that matches both positive and negative integers, with an optional + or - sign.
Oct 24, 2024
Read More Tutorial
bash
How to Create SSL for a Website on Ubuntu
sudo nano /etc/apache2/sites-available/default-ssl.confEnsure that SSL settings match strong encryption standards:
Oct 21, 2024
Read More Tutorial
javascript
Mastering console.log Advanced Usages and Techniques
console.log supports string formatting using placeholders. This allows you to format your output more precisely.
Placeholders:
Sep 02, 2024
Read MoreDiscussion 0
Please sign in to join the discussion.
No comments yet. Be the first to share your thoughts!