title: JavaScript inner function scope chain?
body: <p>In this example</p>
  
  <pre><code>var a = 1;
  ( function(x) {   
     function inner() {
        alert(a);
        alert(x);
        alert(y); 
     }
     var y = 3;
     inner();
  })(2);
  </code></pre>
  
  <p>When does <code>function inner</code> get created? during execution time or parsing time of outer anonymous function? </p>
  
  <p>What is in the scope chain of <code>function inner</code>?</p>
  
  <p>What is the difference between the execution context and scope chain of <code>function inner</code>?</p>
  
  <p>Thanks for enlighting me in advance!</p>