Tell us what’s happening:
Step 9. You should log the generated password to the console. i have done that and it is logging to the console and the password is changing everytime i click but the test is not passing
Your code so far
function generatePassword(length) {
const chars ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()";
let result = "";
for (let i = 0; i < length; i++) {
const randomIndex = Math.floor(Math.random() * chars.length);
result += chars[randomIndex];
}
return result;
}
const password = generatePassword(8);
console.log("Generated password:", password);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:138.0) Gecko/20100101 Firefox/138.0
Challenge Information:
Build a Password Generator App - Build a Password Generator App