1var characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
2var result = ""
3var chaactersLength = characters.length;
4
5for ( var i = 0; i < 5 ; i++ ) {
6 result += characters.charAt(Math.floor(Math.random() * chaactersLength));
7}
8
9console.log(result)
1const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
2function generateRandomCode(){
3 let result = ""
4 let charactersLength = characters.length;
5 for ( var i = 0; i < 6 ; i++ ) {
6 result += characters.charAt(Math.floor(Math.random() * charactersLength));
7 }
8 return result
9}