index.tsx412 chars12 lines
The generatePassword()
function takes in a length
parameter which is the desired length of the password. It then creates a string of possible characters containing only lowercase letters. The function then loops through length
number of times and adds a random character from the possibleChars
string to the password
string.
This function can be easily modified to include uppercase letters, numbers, and special characters in the password if desired.
gistlibby LogSnag