why does my clearInterval not clear the interval? – JavaScript
I got two intervals, one is inside the other: function start(start) { if (start) { firstInterval = setInterval(function () { console.log("firstInterval called") secondInterval = setInterval(function(){ clearInterval(secondInterval) secondInterval = null console.log("secondInterval called") },1000) }, 1000) }else{ clearInterval(firstInterval) firstInterval = null clearInterval(secondInterval) secondInterval = null } } the else block gets called when I press a "stop"… Read More why does my clearInterval not clear the interval? – JavaScript