Tell us what’s happening:
No matter how I spin this code even if the output is right I cannot pass test #9. “You should call the generate password function with a numberic argument and store the returned password in the password variable”
If I put the password variable inside the function test #3 comes back negative on top of test #9. Can someone help me figure out the semantics of this test?
Your code so far
let password = "";
function generatePassword(passLength) {
let generatedPassword = "";
let possibleCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()";
for (let i = 1; i <= passLength; i++) {
generatedPassword += possibleCharacters[Math.floor(Math.random() * possibleCharacters.length)];
}
return generatedPassword;
}
password = generatePassword(8);
console.log(`Generated password: ${password}`);
Your browser information:
User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36
Challenge Information:
Build a Password Generator App - Build a Password Generator App