title: Can functions passed into constructors have access to the constructor's other properties?
body: <p>Typically, calling <code>this</code> would work; but I am calling the method in another context, so <code>this</code> refers to that context rather than the 'parent' object.</p>
  
  <p>Here's the code: </p>
  
  <pre><code>var someConfig = {
    things: [
      {
        attr1: 'foo',
        attr2: 'bar',
        action: function() {
          console.log(this);
        }
      }
    ]
  }
  
  function Constructor(config) {
    var self = this;
    self.name = 'test';
    self.things = config.things;
  
    $.each(self.things, function(i, thing) {
      thing.action();
    });
      }
  
  var obj = new Constructor(someConfig);
  console.log(obj);
  </code></pre>
  
  <p><a href="http://jsfiddle.net/QvMZK/3/" rel="nofollow">Here's a jsfiddle</a>. The goal is to have both objects that are in the console to be the same, but <code>this</code> in the context of the <code>action</code> method returns the original object to which <code>action</code> belongs, rather than the constructor.</p>
  
  <p>The only thing I can think of is to pass <code>self</code> into <code>action</code>, but I think there's a better way.</p>