I am using setInterval(fname, 10000); to call a function every 10 seconds in JavaScript. Is it possible to stop calling it on some event?
setInterval(fname, 10000);
I want the us
Try
let refresch = ()=> document.body.style= 'background: #' +Math.random().toString(16).slice(-6); let intId = setInterval(refresch, 1000); let stop = ()=> clearInterval(intId);
body {transition: 1s}
Stop