title: How clearInterval() clears a timerID inside of a setInterval()?
body: <p>I am new to Javascript and have came across to the topic of stack. In the following piece of code (which is simple in order to focus on basics instead of syntax), I can clear timerID inside of my function expression variable. It is quite common to do so, but my question is how the stack is made here? To be more clear, how the order of  things goes on to clear the variable in which the clearer itself lives? And how the "console.log('DONE!')" is called after clearInterval()?</p>
  
  <pre><code>
  function countNumbers(number){
    var timer = setInterval(function(){
      number++;
      if(number &gt;= 10){
        clearInterval(timer);
        console.log('DONE!');
      }
      else {
        console.log(number);
      }
  
    },1000)
  }
  </code></pre>