JavaScript berhenti setInterval
var myInterval = setInterval(function(){console.log("mmk")}, 2000);
clearInterval(myInterval); //stop that interval
Grepper
var myInterval = setInterval(function(){console.log("mmk")}, 2000);
clearInterval(myInterval); //stop that interval
/* add interval to a variable */
var flashing = setInterval(function(){
$('.flash').toggleClass('red');
},300);
/* add a timerout function to clear the intervalfunction */
setTimeout(function(){
clearInterval(flashing);
},1500);