Password Validator, stuck at step 6, won't return error when validating password with non-uppercase


#1

Tried a few things, and it runs as valid.
tried running an else statement afterward and it didn't work either, stills shows an all lower case password is valid.


#2

Here's a few hints to help you :slight_smile:

[ 1 ] Keep the 5 functions separate – they shouldn't be nested inside each other. Here's an outline framework to start you off:

// These are the four password check functions

function hasUpperCase(input) {

};

function hasLowerCase(input) {

};

function isLongEnough(input) {

};

function hasSpecialCharacter(input) {

};

// This is the fifth "master" function that will call the other
// four functions


function isPasswordValid(input) {

};

[ 2 ] You shouldn't need to use an if…else statement. The four password check functions can be built using a similar pattern of for loops and a single if statement. The fifth "master" function will be a little more complicated but can be built using a set of 5 separate if statements. I'll leave it to you as to what those 5 if statements need to check for :slight_smile:

[ 3 ] The isPasswordValid function will call the the other four functions. If a password rule has been adhered to, then the function that has been called will return true. So, inside the isPasswordValid function, your if statements should check to see if the function has indeed returned true. If it hasn't, then you need to log to the console a message to the user saying the password is not valid – at the moment your code logs a message saying the password is valid :slight_smile:

Hope that helps you get back on track with this project!