title: nested function memory usage in javascript
body: <p>I sort of understand closures in javascript, but what I'm not sure about is how it treats nested functions. For example:</p>
  
  <pre><code>var a = function(o) {
      o.someFunction(function(x) {
          // do stuff
      });
  }
  </code></pre>
  
  <p>I know a new closure is created everytime I call function <code>a</code>, but does that closure also include a new instance of the anonymous function passed to <code>someFunction</code>? Would it better if I did the ff instead:</p>
  
  <pre><code>var b = function(x) { /* do stuff */ }
  var a = function(o) {
      o.someFunction(b);
  }
  </code></pre>