1var characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
2var result = ""
3var charactersLength = characters.length;
4
5for ( var i = 0; i < 5 ; i++ ) {
6 result += characters.charAt(Math.floor(Math.random() * charactersLength));
7}
8
9console.log(result)
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)