forked from ArpanCodeX/PassWordGenerator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
29 lines (22 loc) · 853 Bytes
/
script.js
File metadata and controls
29 lines (22 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const passWordBox=document.getElementById("password");
const lengthOfPassword=12;
const upperCase="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const lowerCase="abcdefghijklmnopqrstuvwxyz";
const numbers="0123456789";
const symbols="!@#$%^&*()_+-=[]{}|;:,.<>?";
const allChar=upperCase+lowerCase+numbers+symbols;
function createPass(){
let password="";
password+=upperCase[Math.floor(Math.random()*upperCase.length)];
password+=lowerCase[Math.floor(Math.random()*lowerCase.length)];
password+=numbers[Math.floor(Math.random()*numbers.length)];
password+=symbols[Math.floor(Math.random()*symbols.length)];
while(password.length<lengthOfPassword){
password+=allChar[Math.floor(Math.random()*allChar.length)];
}
passWordBox.value=password;
}
function copyPass(){
passWordBox.select();
document.execCommand("copy");
}