I'm trying to generate a random password but it always prints the same number?!?
const characters = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9","~","`","!","@","#","$","%","^","&","*","(",")","_","-","+","=","{","[","}","]",",","|",":",";","<",">",".","?",
"/"];
let passElOne = document.getElementById("pass1");
let passElTwo = document.getElementById("pass2");
function generatePass()
{
let randomChar = Math.floor(Math.random() * characters.length)
let newChar = characters[randomChar]
let randomPassword = ""
for(i = 0; i < 15; i++)
{
randomPassword += newChar;
}
passElOne.textContent = randomPassword;
}
What I have tried:
I'm pretty limited on my javascript skills since I'm learning this language the only that I try is to write some if else conditions but it don't work