Question: * Problem 5 : Password Strength Checker * * We want to make it as easy as possible for users to create secure passwords. *

* Problem 5: Password Strength Checker
*
* We want to make it as easy as possible for users to create secure passwords.
* To do this, we want to build a simple password strength checker that will
* tell us if a password is strong enough.
*
* Write a function, checkPasswordStrength() that accepts a password string
* and returns the score of the password based on the following rules:
*1. At least 8 characters long.
*2. Contains at least one uppercase letter
*3. Contains at least one lowercase letter.
*4. Contains at least one digit.
*
*
* Depending on how many of the above rules are met, the score will be
*0,1,2,3 or 4.
* if the type of value is not a string, return null
*
* @param {string} value - a string containing the password to be checked
* @returns {number}- a number between 0 and 4, inclusive
*/
function checkPasswordStrength(value){
// Replace this comment with your code...
} function checkPasswordStrength(value){
if (typeof value !== 'string'){
return null;
}
let score =0;
// Rule 1: Check length
if (value.length >=8){
score++;
}
// Rule 2: Check for uppercase letter
if (/[A-Z]/.test(value)){
score++;
}
// Rule 3: Check for lowercase letter
if (/[a-z]/.test(value)){
score++;
}
// Rule 4: Check for digit
if (/\d/.test(value)){
score++;
}
return score;
}
* Problem 6: Password Strength Checker for any number of password strings
*
* You are asked to score password strength in a list using your
* checkPasswordStrength() function from problem 5.
*
* Where checkPasswordStrength() takes a single password string, the passwordStrengthChecker()
* function takes a list of *any* number of password strings, parses them,
* filters out any invalid ones, and creates a list.
*
* For example: given the following strings, "asd123" and "zdS2sd5d1S",
* a new list would be created of the following form "[2,3]".
*
* Notice how the list has been enclosed in [...] square brackets, and each
* score is separated by a comma and space.
*
* The passwordStrengthChecker() function can take any number of arguments, but they must all
* be strings. If any of the values can't be parsed by checkPasswordStrength()(i.e., if
* it returns null), skip the value. For example:
*
* passwordStrengthChecker("asd123","zdS2sd5d1S",123) should return
*"[2,3]" and skip the invalid value.
*
* @param {number} arguments - any number of string duration arguments can be passed
* @returns {string}
******************************************************************************/
function passwordStrengthChecker(...values){
// Replace this comment with your code...
} give solution as its written in question that its connected to problem 5 so give solution of both problems

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!