A good example where to subscribe a setInterval(), and use a clearInterval() to stop the forever loop:
function myTimer() {
console.log(' each 1 second...');
}
var myVar = setInterval(myTimer, 1000);
call this line to stop the loop:
clearInterval(myVar);