title: Why this behavior for javascript code?
body: <p>Recently one of my friends asked me the output of following code</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var length = 10;
  
  function fn() {
      console.log(this.length);
  }
  
  var obj = {
    length: 5,
    method: function(fn) {
      fn();
      arguments[0]();
    }
  };
  
  obj.method(fn, 1);</code></pre>
  </div>
  </div>
  </p>
  
  <p>I thought the answer would be 10 10 but surprisingly for second call i.e. <code>arguments[0]();</code> the value comes out to be 2 which is length of the arguments passed.
  In other words it seems <code>arguments[0]();</code> has been converted into <code>fn.call(arguments);</code>.</p>
  
  <p>Why this behavior? Is there a link/resource for such a behavior? </p>