Generating Random Alpha-Numeric String

In some cases, we need to generate random strings with JavaScript. Since there is no built-in function for that, we need to bake something out as a solution. With the help of array’s reduce function, we can easily generate a random alpha-numeric string with the desired length.

Note, we multiply the random number by 100, because the toString() method will convert numbers to characters above 9.