Tell us what’s happening:
Cannot understand what is wrong here. Getting the output as expected.
Your code so far
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','!','@','#','$','%','^','&','*','(',')'];
const generatePassword = (passwordLength) => {
let password = '';
const arrayLength = characters.length;
for (let i = 0; i < passwordLength; i++) {
const randomIndex = Math.floor(Math.random() * (arrayLength-0) + 0);
password += characters[randomIndex];
}
return password;
};
let password = generatePassword(8)
console.log(`Generated password:${password}`);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36 Edg/135.0.0.0
Challenge Information:
Build a Password Generator App - Build a Password Generator App