script.js
// set max and min limits to password length and choose random characters from merged array 
set max and min limits to password length and choose random characters from merged array
set max and min limits to password length and choose random characters from merged array
function generatePassword(confirmLength, merged){
    if (confirmLength < 8) {
      alert('Please choose a password length of at least 8 characters. Click \'generate password\' again!');
      location.reload();
    }
    if (confirmLength > 128) {
      alert('Please enter a password length with no more than 128 characters. Click \'generate password\' again!');
      location.reload();
    } else {
        confirmLength = parseInt(confirmLength);
        for (var i = 0; i < confirmLength; i++) { 
          var randomValues = merged[Math.floor(Math.random() * merged.length)];
          randomValuesArray.push(randomValues);
        }
      }
      writePassword(randomValuesArray);
    }
function generatePassword ( confirmLength , merged ) { if ( confirmLength < 8 ) { alert ( 'Please choose a password length of at least 8 characters. Click \'generate password\' again!' ) ; location . reload ( ) ; } if ( confirmLength > 128 ) { alert ( 'Please enter a password length with no more than 128 characters. Click \'generate password\' again!' ) ; location . reload ( ) ; } else { confirmLength = parseInt ( confirmLength ) ; for ( var i = 0 ; i < confirmLength ; i ++ ) { var randomValues = merged [ Math . floor ( Math . random ( ) * merged . length ) ] ; randomValuesArray . push ( randomValues ) ; } } writePassword ( randomValuesArray ) ; }
set max and min limits to password length and choose random characters from merged array
set max and min limits to password length and choose random characters from merged array