Function Arguments Passing and Return
<pre><code>  var foo = {
    bar: function() { return this.baz; },
    baz: 1
  };
  (function(){
    return typeof arguments[0]();
  })(foo.bar);
</code></pre>

<p>Why does this code return <code>undefined</code>?</p>

<p>I would assume <code>arguments[0]</code> would hold the <code>foo.bar</code>, which is a function. When invoked via <code>arguments[0]()</code> it should return the result of the function evaluation in, this case <code>1</code>.  Hence, <code>typeof arguments[0]()</code> should return "Number" (like <code>typeof 1</code>). Instead, it returns <code>undefined</code>. Why?</p>
