how to generate 6 random alphanumerals in js

Solutions on MaxInterview for how to generate 6 random alphanumerals in js by the best coders in the world

showing results for - "how to generate 6 random alphanumerals in js"
Niklas
04 Mar 2016
1let characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
2let result = ''
3let length = 10 // Customize the length here.
4for (let i = length; i > 0; --i) result += characters[Math.round(Math.random() * (characters.length - 1))]
5console.log(result)