Counter

mail@pastecode.io avatar
unknown
javascript
2 years ago
1.3 kB
7
Indexable
Never
let counter1 = document.getElementById('counter1')             
let count1 = 0;
function increment1(){
    count1++;
    counter1.innerText = count1;
}
function decrement1() {
    if (count1 != 0) {
        count1--;
        counter1.innerText = count1;
    }
}

let counter2 = document.getElementById('counter2')      
let count2 = 0;
function increment2(){
    count2++;
    counter2.innerText = count2;
}
function decrement2() {
    if (count2 != 0) {
        count2--;
        counter2.innerText = count2;
    }
}
let counter3 = document.getElementById('counter3')
let count3 = 0;
function increment3(){
    count3++;
    counter3.innerText = count3;
}
function decrement3() {
    if (count3 != 0) {
        count3--;
        counter3.innerText = count3;
    }
}

let counter4 = document.getElementById('counter4')
let count4 = 0;
function increment4(){
    count4++;
    counter4.innerText = count4;
}
function decrement4() {
    if (count4 != 0) {
        count4--;
        counter4.innerText = count4;
    }
}

let counter5 = document.getElementById('counter5')
let count5 = 0;
function increment5(){
    count5++;
    counter5.innerText = count5;
}
function decrement5() {
    if (count5 != 0) {
        count5--;
        counter5.innerText = count5;
    }
}