0
How to generate random string in the easiest way?
I have been trying to make a random string generator from a range of a-z. But, when I made it, it generated numbers instead of string. What should I do? I tried to take code from internet and sololearn to fix my code but it didn't work so well.
1 Answer
+ 2
something like this?
const size = 10;
var letters = "qwertyuiopasdfghjklzxcvbnm";
var randArr = Array.from({length: size}, v => letters[Math.floor(Math.random() * letters.length)]);
document.write(randArr.join(""));