title: Adding Event Listeners in constructor
body: <pre><code>function Foo(elementId, buttonId) {
  this.element = document.getElementById(elementId);
  this.button = document.getElementById(buttonId);
  this.bar = function() {dosomething};
  this.button.addEventListener('click', function(e) {this.bar();}, false);
  }
  
  var myFoo = new Foo('someElement', 'someButton');
  </code></pre>
  
  <p>I'd like to add event listeners inside my constructor, but it doesn't seem to work. Is this something that's possible with the correct syntax? I always get hung up on the line:</p>
  
  <pre><code>this.button.addEventListener('click', function(e) {this.bar();}, false);
  </code></pre>