-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
44 lines (30 loc) · 909 Bytes
/
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
// let firstBatch = 5
// let secondBatch = 7
// let count = firstBatch + secondBatch
// console.log(count)
// intialize the count as 0
// listen for clicks on the increment button
// increment the count variable when the button is clicked (log it out)
// change the count-el in the HTML to reflect the new count
/* const soundBtn = document.querySelector('increment.btn')
let myAudio = document.querySelector('#audio');
soundBtn.addEventListener('click',()=>{myAudio.play();});
fuction incrementBtn() {
} */
let saveEl = document.getElementById("save-el")
let count = 0
let countEl = document.getElementById("count-el")
let audio = new Audio("/sound/click.mp3");
function play() {
audio.play();
}
function increment() {
count += 1
countEl.textContent = count
}
function save() {
let countDash = count + " - "
saveEl.textContent += countDash
countEl.textContent = 0
count = 0
}