Build a Password Generator App - Build a Password Generator App - Test 8

const generatePassword = length => {
  const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()'
  let password = ''

  for (let i = 0; i < length; i++) {
    password += characters[Math.floor(Math.random() * characters.length)]
  }

  return password
}

const password = generatePassword(8)

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

all test have passed except 8: You should call the generatePassword function with a numeric argument and store the returned password in the password variable.

Challenge Information:

Build a Password Generator App - Build a Password Generator App

Please Tell us what’s happening in your own words.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!

there seem to be a conflict with this one, maybe change the name

const generatePassword = length => {
  const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()'
  let password1 = ''

  for (let i = 0; i < length; i++) {
    password1 += characters[Math.floor(Math.random() * characters.length)]
  }

  return password1
}

const password = generatePassword(8)

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

Test 8 still fails

try adding a semicolon at the end of the line

1 Like

Just pasting the error message isn’t the same thing as describing the problem in your own words. Professional programmers have to describe code in their own words all the time, but its a skill that takes a lot of practice to get good at.

1 Like