const random = 'abcdefghijklmnopqrstuvwxyz123456789' const size = 8 let code = "" for(let i = 1; i < size; i++) { code += random[Math.abs(Math.floor(Math.random() * random.length))] } console.log(code.toUpperCase())