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.

14th Sep 2020, 11:15 AM
Skeleton System
Skeleton System - avatar
2 Answers
+ 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(""));
14th Sep 2020, 11:58 AM
Bagon
Bagon - avatar