Last active
March 24, 2019 06:23
-
-
Save pujansrt/ec8977691dc6734f5d8ccec8e663165f to your computer and use it in GitHub Desktop.
Generate Random Password (JS)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split(''); | |
function generatePassword(L){ | |
return Array.from({length: L}) | |
.map(i => alphabet[Math.floor(Math.random() * alphabet.length)]) | |
.join("") | |
} | |
console.log(generatePassword(14)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment