Vote count:
0
I'm trying to generate a token using JavaScript that has been to be exactly 20 characters long and contain both numbers and letters. So far, I would able to get this:
token = Math.random().toString(36).substr(2);
I am using the substr(2) because I want to omit the 0. that prefixes each token.
Unfortunately, this gives me a string with the length of 16. Like these:
fike9vc1ehilik9
ri4htgfera3sdcxr
omo7uqs645k7f1or
I cannot seem to figure out how to get this to 20 characters in length. What can i do this accomplish this?
asked 31 secs ago
Aucun commentaire:
Enregistrer un commentaire