title: Passing an object method by reference to another function in Javascript
body: <p>So I've been trying to get this callback working inside of an object and I was just wondering if:</p>
  
  <p>1) it's possible,
     2) special syntax is required.</p>
  
  <p>So instead of just having a regularly declared function:</p>
  
  <pre><code>function callback() {}
  </code></pre>
  
  <p>And passing that to another function by reference:</p>
  
  <p>doSomething(callback)</p>
  
  <p>Im trying to pass an object property that contains a function:</p>
  
  <pre><code>   {
       prop: function() {}
     } 
  </code></pre>
  
  <p>and send that as a call back.</p>
  
  <p>The problem is, passing the reference of prop throws an error:</p>
  
  <pre><code>doSomething(prop): 
  </code></pre>
  
  <p>throws: <code>Uncaught SyntaxError: Unexpected token :</code></p>
  
  <p>If a complete example is needed, let me know.</p>
  
  <p>Thanks,
  Ken</p>
  
  <p>** Edit **</p>
  
  <p>Okay so after some confusion I'm typing a fairly complete example.</p>
  
  <pre><code>var obj = {
      init: function() {
          this.some_function(this.callback_function)
      },
      some_function: function(callback) {
        callback();
      },
      callback_function: function() {
        // Callback!
      }
  }
  </code></pre>
  
  <p>This is throwing the unexpected token error unless I put the () when I pass this.callback_function as an argument to some_function().</p>
  
  <p>Thanks and sorry for not posting a fuller-example earlier.</p>
  
  <p>Ken</p>