I was making a password generator website (which is for myself) and I was wondering if I could make a download button that downloads a .txt file and the generated password inside the file.
You can visit it here: https://astr-ghe.tk
This is my generate function code:
//generate random password
function generate(){
    //set password length/complexity
    let complexity = document.getElementById("slider").value;
    //possible password values
    let values = "ABCDEFGHIJKLMNOPQRSTUVWZYZabcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()_+";
    let password = "";
    //create for loop to choose password characters
    for(var i = 0; i <= complexity; i++){
        password = password + values.charAt(Math.floor(Math.random() * Math.floor(values.length - 1)));
    }
    //add password to textbox/display area
    document.getElementById("display").value = password;
    //add password to previously generated passwords section
    document.getElementById("lastNums").innerHTML += password + "<br />";
}
 
     
    