Clearing a setInterval
How to clear a setInterval after a certain amount of time
by Christoph
JavaScript
var test = 0;
var myInterval = setInterval(function() {
if (test){
clearInterval(myInterval);
}
console.log("do stuff");
}, 50);
setTimeout(function(){test = 1},500)