生成随机验证码

181 阅读1分钟

生成4位数字

("000" + Math.ceil(Math.random() * 9999)).substr(-4)

生成4位字母+数字

Math.random().toString(36).substr(2, 4)