Hi guys. I have a problem, when i hit the button on my page its supposed to generate a 15 character password from an Array.
This currently works but i need to make sure it cant exceed 15 characters.
Right now you can keep pushing the button and it will keep Adding another 15 characters (so 15 to 30 to 45 and so forth)
I'm almost certain the solution is either Boolean Statements.
Or a mistake with the "+=" operator in the bottom.
thank you in advance,
I hope my question makes sense 😄
function generatePasswords() {
for (let i = 0; i < 15; i++) {
let randomIndexOne = Math.floor( Math.random() * characters.length )
let randomIndexTwo = Math.floor( Math.random() * characters.length )
passwordBoxOne.textContent += characters[randomIndexOne]
passwordBoxTwo.textContent += characters[randomIndexTwo]
}
}