title: setTimeout timer event
body: <pre><code>function waitForThreeSeconds(){
      setTimeOut(function(){
         console.log('Time done');
      },3000);
  }
  
  waitForThreeSeconds();
  console.log('finished execution');
  </code></pre>
  
  <p>In the code above, when the waitForThreeSeconds function is invoked an event is placed on the event queue for the setTimeout method. My question is when the waitForThreeSeconds function is invoked, will the three second timer in the function expression passed into setTimeout start immediately when the JS engine encounters the setTimeout method? Or will an event be placed on the event queue. Then after console.log("finished execution') line of code is run in the global execution context (which means everything is done executing in the JS file), then the three second timer will start and the callback function passed to setTimeout will run.</p>
  
  <p>I am not sure when the timer in the setTimeout function actually starts. Would it start exactly when the JS engine encounters the setTimeout method or will the three second timer start when the JS engine goes to the event queue to process the event placed by the setTimeout method?</p>