setinterval and stop code example
Example 1: stop a setinterval
let myVar = setInterval(() => {console.log('bop'), 1000);
clearInterval(myVar);
Example 2: setinterval break
var refreshIntervalId = setInterval(fname, 10000);
/* later */
clearInterval(refreshIntervalId);