1var btn = document.getElementById("btn");
2
3btn.addEventListener("click", function generate() {
4 var generatePassword = "";
5 var password = document.getElementById("password");
6 var characters =
7 "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*?";
8
9 for (var i = 0; i < 10; i++) {
10 generatePassword += characters.charAt(
11 Math.floor(Math.random() * characters.length)
12 );
13 }
14 password.innerHTML = generatePassword;
15});
16