stop setinterval on condition code example
Example 1: stop a setinterval
let myVar = setInterval(() => {console.log('bop'), 1000);
clearInterval(myVar);
Example 2: stop interval js
clearInterval(interval)
let myVar = setInterval(() => {console.log('bop'), 1000);
clearInterval(myVar);
clearInterval(interval)