Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

generate random password

var btn = document.getElementById("btn");

btn.addEventListener("click", function generate() {
  var generatePassword = "";
  var password = document.getElementById("password");
  var characters =
    "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*?";

  for (var i = 0; i < 10; i++) {
    generatePassword += characters.charAt(
      Math.floor(Math.random() * characters.length)
    );
  }
  password.innerHTML = generatePassword;
});
Source by onecompiler.com #
 
PREVIOUS NEXT
Tagged: #generate #random #password
ADD COMMENT
Topic
Name
5+2 =