title: Basic Closure Example Confusion
body: <p>I'm following a tutorial by Tyler McGinnis on execution contexts, call stacks and closures.</p>
  
  <p><a href="https://www.youtube.com/watch?v=Nt-qa_LlUH0&amp;feature=emb_title" rel="nofollow noreferrer">https://www.youtube.com/watch?v=Nt-qa_LlUH0&amp;feature=emb_title</a></p>
  
  <p>I'm a bit confused with the closure example. I understand a closure is when a function is inside another function. I also understand that the inner function has access to the parent functions arguments (As explained in the video).</p>
  
  <p>My confusion is in the code below is when makeAdder(5) is invoked is the inner function not invoked aswell on the first invokation? Tyler appears to suggest makeAdder is popped off the call stack when first invoked just leaving the inner function untouched.</p>
  
  <p>The second part I don't understand when we call add5(2) this is invoking makeAdder(5) no? How do we add 2 arguments when the parent function only accepts one?</p>
  
  <p>If someone could walk it through step by step of how it's all invoked that would be great!</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var count = 0;
      
      function makeAdder(x) {
          return function inner(y) {
              return x + y;
          }
      }
      
      var add5 = makeAdder(5);
      console.log(add5); // what the call to makeAdder returns
      count += add5(2);
      console.log(count);</code></pre>
  </div>
  </div>
  </p>