当前位置:网站首页>Random acquisition of 4-digit non repeated verification code
Random acquisition of 4-digit non repeated verification code
2022-06-12 08:39:00 【Pumpkin_ xiaoXuan】
function getCode() {
let str = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789'
let code = ''
// while Execute when the conditions are met , If the conditions are not met, the system will jump out of "do not execute"
while (code.length < 4) {
// Math.round The rounding method
// Math.random Random access 0-1 Number between
// *61 Because the verification code is from a-z,A-Z,1-9 Yes 62 position ,str String from 0 Start calculating , So we need to *61
let random = Math.round( Math.random() * 61)
if(code.indexOf(str[random]) === -1) {
code += str[random]
}
}
return code
}
const res = getCode()
console.log('res', res);边栏推荐
- js中的数组
- (P13) use of final keyword
- js实现页面加载后再刷新一次
- 【数据存储】浮点型数据在内存中的存储
- Error: clear the history in the search box in the website?
- 【 pointeur avancé Ⅲ】 mise en œuvre de la fonction de tri rapide qsort& fonction de rappel en langage C
- Beidou satellite navigation system foundation part 1
- 深拷贝与浅拷贝的区别
- (p15-p16) optimization of the right angle bracket of the template and the default template parameters of the function template
- Seurat package addmodulescore is used for bulk RNA SEQ data
猜你喜欢

Hands on deep learning -- weight decay and code implementation

Error: clear the history in the search box in the website?

Ankerui fire emergency lighting and evacuation indication system

(p27-p32) callable object, callable object wrapper, callable object binder
![[compilation principle] understand BNF](/img/64/9a0e7507606781336fdc44116ba423.jpg)
[compilation principle] understand BNF

超全MES系统知识普及,必读此文

Why should enterprises implement MES? What are the specific operating procedures?

ctfshow web3

Engineers learn music theory (I) try to understand music

Hands on deep learning -- implementation of multi-layer perceptron from scratch and its concise implementation
随机推荐
At present, MES is widely used. Why are there few APS scheduling systems? Why?
When converting tensor to ndarray in tensorflow, the run or Eval function is constantly called in the loop, and the code runs more and more slowly!
(P14) use of the override keyword
What is the beauty of MES equipment management for enterprises?
余压监控系统保证火灾发生时消防疏散通道的通畅,为大型高层建筑的安全运行和人民生命财产安全保驾护航
X64dbg debugging exception_ ACCESS_ VIOLATION C0000005
ctfshow web4
MYSQL中的锁的机制
Adjust SVG width and height
[advanced pointer III] implement C language quick sorting function qsort & callback function
Bean的作用域
Close asymmetric key
Vscode 调试TS
MES helps enterprises to transform intelligently and improve the transparency of enterprise production
ctfshow web 1-2
网站Colab与Kaggle
[GUI development] browsing function implementation model of image processing software
vscode 下载慢解决办法
Record the first step pit of date type
Hands on learning and deep learning -- simple implementation of softmax regression