How to stop setInterval from another function, calling its owner function using js

  javascript, setinterval, settimeout
let timer = 0;

function func2() {
  clearInterval(timer)
}

anybtn.addEventListener('click', func2);

function func1() {
  timer = setInterval(func1, 1000);
}

Source: Ask Javascript Questions

LEAVE A COMMENT