title: what is the javascript mechanism/rules that allow `p.foo = o.foo` to return a reference to the function `foo`?
body: <p>I'm currently studying javascript by following the book "you dont know js" series. </p>
  
  <p>In the "this &amp; object prototype" section, when discussing "indirect references to functions", the author states </p>
  
  <blockquote>
  <pre><code>function foo() {
    console.log( this.a );
  }
  
  var a = 2;
  var o = { a: 3, foo: foo };
  var p = { a: 4 };
  
  o.foo(); // 3
  (p.foo = o.foo)(); // 2
  </code></pre>
    
    <p>The result value of the assignment expression p.foo = o.foo is a
    reference to just the underlying function object. As such, the
    effective call-site is just foo(), not p.foo() or o.foo() as you might
    expect. Per the rules above, the default binding rule applies.</p>
  </blockquote>
  
  <p>So apparently, <code>(p.foo = o.foo)</code> return a reference to the function <code>foo</code>. But  what is the mechanism/rules that allow  <code>(p.foo = o.foo)</code> return a reference to the function <code>foo</code>? In other words, why a simple assignment return a reference to <code>foo</code> function? </p>