-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
58 lines (47 loc) · 1.51 KB
/
index.js
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// CONSTANTS
const letterS = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
// theme toggle
function darkmodE() {
var element = document.body;
element.classList.toggle("eyebleed")
}
// change text
function changE() {
var x = document.getElementById("helloDIV");
if (x.innerHTML === "Hello World!") {
x.innerHTML = "Goodbye!";
} else {
x.innerHTML = "Hello World!";
}
}
//function pasS() {
// var x = document.getElementById("passDIV");
// //wtf... just make it random
// for (let i in letterS) {
// console.log(i);
// }
// x.innerHTML = "5";
//}
function pasS() {
var x = document.getElementById("passDIV");
// targets [passDIV]
var picK = letterS[Math.floor(Math.random() * letterS.length)];
// targets [letterS]
// multiplies [letterS] length times a random float between 0 and 1
// - basically divides it
// math.floor rounds it to the closest lowest number
// - that picks the index number from the array
let pasS = []
for (let i = 0; i < 11; i++) {
// for loop that goes from 0 to 10
var pick1 = letterS[Math.floor(Math.random() * letterS.length)];
pasS.push(pick1);
}
passSTR = String(pasS)
//makes array into string
for (let i = 0; i < 11; i++) {
passCLEAN = passSTR.replace(',', '');
//removes comma(s)
}
x.innerHTML = passCLEAN
}