Question: I am trying to reprompt the user if the password length is less than 8 or greater than 128 characters. the condition for less than

I am trying to reprompt the user if the password length is less than 8 or greater than 128 characters. the condition for less than eight is working but the last condition in the while loop is not working properly. What am I doing wrong?

let askUser; // create a function for prompts const prompts = () => { const minLength = 8; const maxLength = 128; askUser = prompt('Enter a password character length. Character length must be at least 8 and between 128.'); while (askUser < minLength || askUser === null || askUser > maxLength) { // ask the user again askUser = prompt('Enter a password character length. Character length must be at least 8 and between 128.'); let confirmSpecialCharacter; // if password is between length range if (askUser >= minLength && askUser <= maxLength) { // ask for special characters confirmSpecialCharacter = confirm('Would you like for your password to include special characters?'); // if yes, call combine random if (confirmSpecialCharacter === 'yes') { let pass = combineRandom(); alert(pass); } else { let pass = noSpecialCharacters(); alert(pass); }

}

}

return askUser;

}

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!