随机获取4位26个英文字母和数字组合的值(4位随机码)
var a = 'qwertyuiopasdfghjklzxcvbnm1234567890' var b = a.split('') var str = '' for (let i = 0; i < 4; i++) {str += b[Math.ceil(Math.random() * b.length - 1)] } console.log(str)
随机获取4位26个英文字母和数字组合的值(4位随机码)
var a = 'qwertyuiopasdfghjklzxcvbnm1234567890' var b = a.split('') var str = '' for (let i = 0; i < 4; i++) {str += b[Math.ceil(Math.random() * b.length - 1)] } console.log(str)