**/let createPassword = function (num, b) { let n = 0 //循环次数 let arr = new Array // 随机数保存 let Capitalization = () => Math.floor(Math.random() * b)// 随机取数0-2/0-1 let randomNumber = [() => Math.floor(Math.random() * (57 - 48 + 1) + 48), () => Math.floor(Math.random() * (122 - 97 + 1) + 97), () => Math.floor(Math.random() * (90 - 65 + 1) + 65)] // 去随机值 for (let i = 0; i < num; i++) { arr.push(randomNumber[Capitalization()]()) } return arr.map(e => String.fromCharCode(e)).join('')}let passwordStrength = function (num, len) { if(num.length<len) return '密码长度不够' let passwordLevel = ['弱', '普通', '较强', '强'] let arr = new Array(4) // 记录密码等级 num.split('').map(e => e.charCodeAt()).forEach(e => { if (e >= 48 && e <= 57) { arr[0] = 1 } else if (e >= 65 && e <= 90) { arr[1] = 1 } else if (e >= 91 && e <= 122) { arr[2] = 1 } else { arr[3] = 1 } }) return passwordLevel[arr.reduce((a, b) => a + b) - 1]}修改下



