title: replacing a function passed by reference in javascript
body: <p>My understanding is in javascript a function is passed by reference... and in this case I am trying to replace one function with another. It is not working. I am sure I am missing something simple. But what?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var spit = {
   spittle: function (x) {
    console.log('i spittle at ' + x);
   }
  }
  
  replaceFunc = {
   replace: function (func) {
    func = console.log;
   }
  }
  
  replaceFunc.replace(spit.spittle);
  
  spit.spittle('joe'); /// should be just 'joe' instead the spittle func is not replaced and it outputs 'i spittle at joe'</code></pre>
  </div>
  </div>
  </p>