-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
52 lines (47 loc) · 1.31 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
let count = 0
let saveEl = document.getElementById("save-el")
let countEl = document.getElementById("count-el")
let left = 0;
let entered = 0;
// let entered = 0
function increment() {
count += 1
countEl.textContent = count
entered = count;
}
function save() {
let entry = 0;
entry++;
// let countStr = count + " - "
// saveEl.textContenttStr
// countEl.textContent = 0
// count = 0
// let totalNu = count;
if (count == 0)
{
let combine = ` on your ${entry} trip, you have ${entered} people entered the bus from the pack, and ${left} left the bus before it got to the final terminal \n`
saveEl.textContent += combine;
return;
}
let combine = ` on your ${entry} trip, you have ${entered} people entered the bus from the pack, and ${left} left the bus before it got to the final terminal \n`
saveEl.textContent += combine;
count = 0;
entered = 0;
countEl.textContent = count
left = 0;
if (entry >= 24)
entry = 0;
// console.log(count);
}
function decrement () {
if (count >= 1)
{
left++
// let numberleft = count - 1
// countEl.innerText = numberleft;
count--;
countEl.innerText = count;
// entered = count;
}
}
console.log("Let's count people on the subway!")