btn.js 189 B

12345678910
  1. function clickCounter(btn){
  2. let sum = 0;
  3. btn.onclick = () => {
  4. btn.innerHTML = sum;
  5. sum++;
  6. console.log(sum);
  7. }
  8. };
  9. clickCounter(btn1);
  10. clickCounter(btn2);