title: Javascript scope: passing a variable from an outer function to an inner function
body: <p>I define the variable "a" in the outerFunction. I want to use it in my innerFunction. How come this doesn't work, and what is the best way to pass data between nested functions?</p>
  
  <pre><code>var outerFunction = function () {
     var a = 5;
     innerFunction();
  }
  
  
  var innerFunction = function () {
     alert(a);
  }
  
  outerFunction();
  </code></pre>