
xuzhe0211
V1
2023/01/30阅读:14主题:默认主题
js 生成随机密码
const symbols = '~!@#$%^&*()_+{}":?><;.,';
let list = [
String.fromCharCode(Math.floor(Math.random() * 26 + 65)),
String.fromCharCode(Math.floor(Math.random() * 26 + 96)),
String.fromCharCode(Math.floor(Math.random() * 10 + 48)),
symbols[Math.floor(Math.random() * symbols.length)]
]
let str = ''
for(let i = 0; i < 8; i++) {
str += list[Math.floor(Math.random() * 4)]
}
console.log(str)
作者介绍

xuzhe0211
V1