script.js
//this function begins here, and we are defining a function here, and it will prompt the user for password options 
this function begins here, and we are defining a function here, and it will prompt the user for password options
this function begins here and we are defining a function here and it will prompt the user for password options
function generateOptions(){
  var passwordLength = parseInt(prompt("How many characters would you like for your password?"));
  if (parseInt(passwordLength)===NaN) {
    alert("You must have an entered number value ")
  } else if (passwordLength < 8 || passwordLength > 128) {
    alert(" please choose number between 8 and 128 Characters!")
  }
  var lowerCase = confirm("Do you want a lower case letter in your password?");
  var upperCase = confirm("Do you want a upper case letter your password?");
  var numbers = confirm("Do you want numbers in your password?");
  var specialCharacters = confirm("Would you like special characters in your password?");
  if (!lowerCase && !upperCase && !specialCharacters && !numbers) {
        alert("You must pick at least one of the criteria!!");
        return;
  }
  var optionsObj = {
    lower: lowerCase,
    upper: upperCase,
    numbers: numbers,
    specialCharacters: specialCharacters,
    passwordLength: passwordLength,
  }
  return optionsObj;
}
function generateOptions ( ) { var passwordLength = parseInt ( prompt ( "How many characters would you like for your password?" ) ) ; if ( parseInt ( passwordLength ) === NaN ) { alert ( "You must have an entered number value " ) } else if ( passwordLength < 8 || passwordLength > 128 ) { alert ( " please choose number between 8 and 128 Characters!" ) } var lowerCase = confirm ( "Do you want a lower case letter in your password?" ) ; var upperCase = confirm ( "Do you want a upper case letter your password?" ) ; var numbers = confirm ( "Do you want numbers in your password?" ) ; var specialCharacters = confirm ( "Would you like special characters in your password?" ) ; if ( ! lowerCase && ! upperCase && ! specialCharacters && ! numbers ) { alert ( "You must pick at least one of the criteria!!" ) ; return ; } var optionsObj = { lower : lowerCase , upper : upperCase , numbers : numbers , specialCharacters : specialCharacters , passwordLength : passwordLength , } return optionsObj ; }
this function begins here, and we are defining a function here, and it will prompt the user for password options
this function begins here and we are defining a function here and it will prompt the user for password options
//write prompts for length. This will show up on user's screen asking them about how long they want their password to be. //check IF length is < 8 , which means length is to small //check IF length is > 128, which mean length is too large //NaN: means not a number. ParsInt-Converts strings into a number. //If the password is less than 8 or it is less than 128 alert..... //prompt lowercase. This confirm is a Boolean. // console.log(lowerCase); //prompts for uppsercase? // console.log(upperCase); //Prompts for numbers? T // console.log(numbers); //Prompts for special characters? // console.log(specialCharacters); //This if statement allows us to tell the user to select a password criteria if they fail to choose any given options //The purpose of return is to show the final answer, terminate the fuction and not execute any more code.  //Normally return comes at the end of a function //create an obj with the vars. These are known as key values pairs. The key is how you access it and the value is what you get back after you access it. //The arrays are grouped together into this logical construct or a bucket. //This is called object dot notation// // console.log(optionsObj.upper) //Whatever gets returned gets assigned to the variable //the function is a long one and ends here