Build a Password Generator App - Build a Password Generator App

Tell us what’s happening:

It looks like my code is working, but it is not passing all the other tests. How can I resolve this?

Your code so far


let password = ""
const generatePassword = (passwordLength) => {

  let characters
="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()"
  for(let i = 0; i < passwordLength; i++){
    let randomIndex = Math.floor(Math.random() * characters.length)
    password += characters[randomIndex]

  }
  return password
}

console.log(generatePassword(4))
console.log(`Generated password: ${password}`)
console.log(password.length)

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) 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
https://www.freecodecamp.org/learn/full-stack-developer/lab-password-generator/lab-password-generator

what are you asked to do with this variable?