[JavaScript] How to create an array of random strings?
I want to create an array of random strings with a given length, how can we do that in Javascript?
1 Answer
4 years ago by Anusha
You can use the below code to create an array of random strings.
[...Array(arrLength)].map(() => {
return Math.random().toString(20).substr(2, strLength)
});
Check and Run the working sample here : https://onecompiler.com/javascript/3xmzqgcfm
4 years ago by Meera