title: what is the lifetime of javascript anonymous function?
body: <p>If I write this in global scope:</p>
  
  <pre><code>(function(){})();
  </code></pre>
  
  <p>is the anonymous function created when the statement is executed and destroyed immediately after the statement is executed?</p>
  
  <p>if I write this in a function:</p>
  
  <pre><code>function foo()
  {
      var a=1;
      (function(){})();
      a++;
  }
  </code></pre>
  
  <p>Does the anonymous function exist until foo returns, or just exist during the execution of that statement? </p>