前言 本文主要给大家介绍了关于利用javascript随机生成一定位数密码的相关内容,分享出来供大家参考学习,下面话不多少,来一起看看详细的介绍吧。 需求 随机生成一定位数的密码,有最小个数和最大个数,必须包含数字、大小写字母,和特殊字符比如(- _ #); 代码 function createPassword(min,max) { //可以生成随机密码的相关数组 var num = ["0","1","2","3","4","5","6","7","8","9"]; var english = ["a","b","c","d","e","f","g","h","i","j","k",