-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
26 lines (18 loc) · 791 Bytes
/
app.js
File metadata and controls
26 lines (18 loc) · 791 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
let rangeSlider = document.getElementById("passLenght")
let output = document.getElementById("rangeValue")
output.innerHTML = rangeSlider.value
rangeSlider.oninput = function () {
output.innerHTML = this.value;
};
function passwordGenerator() {
let characters = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+{}[]/<>:;'"
let text = document.getElementById("text").value
let passLenght = rangeSlider.value - text.length
let password = ""
for (i = 0; i < passLenght; i++) {
let randomNum = Math.floor(Math.random() * characters.length)
password += characters[randomNum]
}
console.log("Yor Password is ==>", password)
document.getElementById("pass").innerText = text + password
}