生成随机生成字符串----用于密码加盐 var time = Date.now() % 100, str = ''; time = time === 0 ? '00' : String(time); // 可以修改长度 for (let i = 0; i < 18; i++) { const base = Math.random() < 0.5 ? 65 : 97; str += String.fromCharCode( base + Math.floor( Math.random() * 26 ) ); } console.log( time + str)