Home > Article > Web Front-end > js random string regular method ([A~Z],[a~z],[0~9])
This time I will bring you the random string of jsregular method ([A~Z],[a~z],[0~9]), the random string regular method of js ( [A~Z],[a~z],[0~9])NotesWhat are the following? Let’s take a look at the actual cases.
function ranNum(l) { return Math.floor(Math.random() * (l[1] - l[0])) + l[0]; }function r(len) { var s = "",t; for (; len > 0; len--) { t = ranNum([[65, 91], [97, 123],[0, 10] ][ranNum([0, 3])]); s = s + (t > 10 ? String.fromCharCode(t) : t.toString()); } return s; }console.log("测试",r(10));I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to the php Chinese website
Other related articles!
Related reading:nodejs How to use http module to write upload image interface test client
h5 production performance change polyline Figure
Detailed explanation of front-end and back-end development separation of Golang+Nodejs
How to make image upload preview component in H5
The above is the detailed content of js random string regular method ([A~Z],[a~z],[0~9]). For more information, please follow other related articles on the PHP Chinese website!