title: Javascript: Function inside object not working
body: <p>I am trying to create a controller in Javascript, which will respond to button clicks and change the view accordingly.</p>
  
  <p>I have a function which works that looks like this:</p>
  
  <pre><code>document.getElementById("reset").onclick = function () { 
      //do something
  
     };
  </code></pre>
  
  <p>However, when I try to put the function in a controller object, I get an "unexpected token" error:</p>
  
  <pre><code>var controller = {
    this.reset = document.getElementById("reset").onclick = function () { 
      //do something
  
     };
  }
  </code></pre>
  
  <p>I'm not sure about 2 things:</p>
  
  <ol>
  <li>How to fix this error? (I know its due to scope, but don't know how to fix it in a way that still follows MVC patterns)</li>
  <li>Generally speaking, is this a good way to go about creating a controller object? (I'm new to the MVC model, and don't know if I'm following best practices.)</li>
  </ol>
  
  <p>Thanks.</p>