main.js 445 B

123456789101112131415161718
  1. const decreasebtn = document.getElementById("dec");
  2. const resetbtn = document.getElementById("res")
  3. const increasebtn = document.getElementById("inc")
  4. const label = document.getElementById("label")
  5. let count=0;
  6. increasebtn.onclick = function (){
  7. count++;
  8. label.textContent=count;
  9. }
  10. decreasebtn.onclick = function (){
  11. count--;
  12. label.textContent=count;
  13. }
  14. resetbtn.onclick = function (){
  15. count=0;
  16. label.textContent=count;
  17. }