美文网首页
JS 随机字符串

JS 随机字符串

作者: Sh1mmer | 来源:发表于2021-11-08 15:09 被阅读0次
randomString: function (e) {
      e = e || 32;
      var t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
          a = t.length,
          n = "";
      for (let i = 0; i < e; i++) {
        n += t.charAt(Math.floor(Math.random() * a));
      }
      return n
    },

相关文章

网友评论

      本文标题:JS 随机字符串

      本文链接:https://www.haomeiwen.com/subject/ckwuzltx.html