-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
57 lines (38 loc) · 1.2 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
var timer = 60;
var score = 0;
var hitrn = 0;
function runtimer() {
let clutter = "";
for (var i = 1; i <= 150; i++) {
var random = Math.floor(Math.random() * 10);
clutter += `<div class="bubbles"><span>${random}</span></div>`;
}
document.querySelector(".panel-bottom").innerHTML = clutter;
var timerint = setInterval(function () {
if (timer > 0) {
timer--;
document.querySelector("#time-reval").textContent = timer;
} else {
clearInterval(timerint);
document.querySelector(".panel-bottom").innerHTML = "";
}
}, 1000);
}
function getnewhit() {
hitrn = Math.floor(Math.random() * 10);
document.querySelector("#class-hit").textContent = hitrn; // Corrected typo
}
function increaseScore(){
score +=10;
document.querySelector("#score-val").textContent = score;
}
document.querySelector(".panel-bottom").addEventListener("click",function(dets){
var clicked = Number(dets.target.textContent);
if(clicked === hitrn){
getnewhit();
increaseScore();
}
})
runtimer();
getnewhit();
// increaseScore();