Math.random(): 生成的是随机16/17位小数.
通过toString(36): 发现小数点后的数字转为0·9a·z的值;
substring(3, 8): 从下标3开始,到8结束,不包括8
//生成的是随机16/17位小数 console.log(Math.random()); //0.02613552458980939 //通过toString(36)后发现小数点后的数字转为0·9a·z的值 console.log(Math.random().toString(36)); //0.uw2ikirke2g // 生成随机生成五个字母或数字的随机数 // substring从下标3开始,到8结束,不包括8 console.log(Math.random().toString(36).substring(3, 8)); //27s1l