title: Console returns undefined
body: <p>So I've hijacked the console function:</p>
  <pre><code>var log = Function.prototype.bind.call(console.log, console);
  console.log = function (a) {
      log.call(console, a);
      submitmsg(&quot;Log&quot;, a);
  };
  </code></pre>
  <p>This has the desired effect. However, it also returns &quot;undefined&quot; as an unexpected bonus.</p>
  <p>I can't figure out why which leads me to think there is something slightly wrong here.</p>
  <p><img src="https://i.stack.imgur.com/Gex5K.png" alt="Enter image description here" /></p>
  <p>Hello world is generated by <code>log.call(console, a)</code> as expected</p>
  <p><code>submitmsg()</code> is my custom function</p>
  <p>This is working exactly how I want. As I said though, I'm slightly concerned that it is also returning &quot;undefined&quot; for reasons I do not understand.</p>
  <hr />
  <p><strong>Note:</strong> The following code was posted by the OP as an answer to the question. The comments on the answer have been moved to the comments on the question.</p>
  <hr />
  <p>So should the correct code be the following?</p>
  <pre><code>var log = Function.prototype.bind.call(console.log, console);
  console.log = function (a) {
      return log.call(console, a);
      submitmsg(&quot;Log&quot;, a)
  };
  </code></pre>