Tell us what’s happening:
I have successfully completed this lab’s user stories but the tests won’t pass cos the test number 8 keeps saying “You should call the generatePassword function with a numeric argument and store the returned password in the password variable” even when I have done that in my code. Any ideas as to what I could try?
Your code so far
function generatePassword(length){
let characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()"
let passwordResult = ""
for (let i = 0; i < length; i++){
let randomNumbers = Math.floor(Math.random() * characters.length)
passwordResult += characters[randomNumbers]
}
return passwordResult
}
console.log(generatePassword(4));
let password = generatePassword(15)
console.log(`Generated password: ${password}`)
console.log("Password Length = " + password.length)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Challenge Information:
Build a Password Generator App - Build a Password Generator App