function generatePassword() {
    // set var for password length
    var passwordLength = prompt("How many characters would you like? Choose an amount from 8 to 128");
    // if statement to disallow password less than 8 char or more than 128
    if (passwordLength >= 8 && passwordLength <= 128) {
        // arrays for possible characters
        lowerCase = confirm("Would you like to include lowercase letters?");
        upperCase = confirm("Would you like to include uppercase letters?");
        symbols = confirm("Would you like to include symbols?");
        numbers = confirm("Would you like to include numbers?");
    // if user does not enter a number or blank, disallow
    } else if (passwordLength !== "" && passwordLength !== null) {
    alert("Please select between 8 and 128 characters");
    // allow confirm series for char fields if input satisfies char length
    } else {
        alert("Cannot generate password without at least one character type selection. Please try again")
    }   
        // if statements to concatenate strings for password
        if (lowerCase) {
            allOptions += lowerCaseOptions
        };
        // console.log(allOptions);
        
        if (upperCase) {
            allOptions += upperCaseOptions
        };
        // console.log(allOptions);
        
        if (symbols) {
            allOptions +=  symbolsOptions
        };
        // console.log(allOptions);
        
        if (numbers) {
            allOptions += numbersOptions
        };
        // declare var for result of all confirms
        var randomPassword = "";
            // loop to go through previously selected options
            for (var i = 0; i < passwordLength; i++) {
                // random password generated based on chosen Options
                randomPassword += allOptions.charAt(
                Math.floor(Math.random() * allOptions.length)
                );
                // string assembling user selected Options of characters
                } return randomPassword;
            }
// Button to begin prompts/confirms for password
Button to begin prompts/confirms for password
Button to begin prompts / confirms for password
function generatePassword() {
    var passwordLength = prompt("How many characters would you like? Choose an amount from 8 to 128");
    if (passwordLength >= 8 && passwordLength <= 128) {
        lowerCase = confirm("Would you like to include lowercase letters?");
        upperCase = confirm("Would you like to include uppercase letters?");
        symbols = confirm("Would you like to include symbols?");
        numbers = confirm("Would you like to include numbers?");
    } else if (passwordLength !== "" && passwordLength !== null) {
    alert("Please select between 8 and 128 characters");
    } else {
        alert("Cannot generate password without at least one character type selection. Please try again")
    }   
        if (lowerCase) {
            allOptions += lowerCaseOptions
        };
        if (upperCase) {
            allOptions += upperCaseOptions
        };
        if (symbols) {
            allOptions +=  symbolsOptions
        };
        if (numbers) {
            allOptions += numbersOptions
        };
        var randomPassword = "";
            for (var i = 0; i < passwordLength; i++) {
                randomPassword += allOptions.charAt(
                Math.floor(Math.random() * allOptions.length)
                );
                } return randomPassword;
            }
function generatePassword ( ) { var passwordLength = prompt ( "How many characters would you like? Choose an amount from 8 to 128" ) ; if ( passwordLength >= 8 && passwordLength <= 128 ) { lowerCase = confirm ( "Would you like to include lowercase letters?" ) ; upperCase = confirm ( "Would you like to include uppercase letters?" ) ; symbols = confirm ( "Would you like to include symbols?" ) ; numbers = confirm ( "Would you like to include numbers?" ) ; } else if ( passwordLength !== "" && passwordLength !== null ) { alert ( "Please select between 8 and 128 characters" ) ; } else { alert ( "Cannot generate password without at least one character type selection. Please try again" ) } if ( lowerCase ) { allOptions += lowerCaseOptions } ; if ( upperCase ) { allOptions += upperCaseOptions } ; if ( symbols ) { allOptions += symbolsOptions } ; if ( numbers ) { allOptions += numbersOptions } ; var randomPassword = "" ; for ( var i = 0 ; i < passwordLength ; i ++ ) { randomPassword += allOptions . charAt ( Math . floor ( Math . random ( ) * allOptions . length ) ) ; } return randomPassword ; }
Button to begin prompts/confirms for password
Button to begin prompts / confirms for password
// set var for password length // if statement to disallow password less than 8 char or more than 128 // arrays for possible characters // if user does not enter a number or blank, disallow // allow confirm series for char fields if input satisfies char length // if statements to concatenate strings for password // console.log(allOptions); // console.log(allOptions); // console.log(allOptions); // declare var for result of all confirms // loop to go through previously selected options // random password generated based on chosen Options // string assembling user selected Options of characters