Well, I’m stumped! Why do you think this test isn’t passing? Thank you!
- You should call the
generatePassword
function with a numeric argument and store the returned password in thepassword
variable.
Here’s my code:
function generatePassword(passLength) {
let password = '';
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()"
for (let i = 0; i < passLength; i++) {
password = password + chars[Math.floor(Math.random() * (chars.length))]
}
return password;
}
let password = generatePassword(16)
console.log(`Generated password: ${password}`)
// console output
Generated password: 544B9#wbbp!xOoD8
Browser info: Safari Version 18.5