title: Prototype Chain - Is the prototype chain used in this case?
body: <p>I am following along Kyle Simpson's YouDontKnowJS on <a href="http://frontendmasters.com" rel="nofollow">frontendmasters.com</a> and am confused by one of his examples.</p>
  
  <p>Here is the example code:</p>
  
  <pre><code>function Foo(who){
      this.me = who;
  }
  
  Foo.prototype.identify = function() {
      return "I am " + this.me;
  };
  
  function Bar(who) {
      Foo.call(this, who);
  }
  
  
  Bar.prototype = Object.create(Foo.prototype);
  
  Bar.prototype.speak = function() {
      alert("Hello, " + this.identify() + ".");
  }
  
  var b1 = new Bar("b1");
  var b2 = new Bar("b2");
  
  b1.speak();
  b2.speak();
  </code></pre>
  
  <p>When calling <code>new Bar("b1")</code>; he walks you through what is happening with the prototype chain when b1.speak() is called</p>
  
  <ul>
  <li>On the <code>Bar.prototype</code> the alert function is called, this.identify() is also called.</li>
  <li>When this.identify() is called it is not found on the <code>this</code> object (b1) so it looks up to it's prototype.</li>
  <li>Looking at <code>Bar.prototype</code> it does not find the identify method, so it looks up it's prototype chain again.</li>
  <li>It now finds the identify method on <code>Foo.prototype</code></li>
  </ul>
  
  <p>Here is what I am unclear of.  When we call <code>Bar.prototype = Object.create(Foo.prototype)</code>, shouldn't <code>Bar.prototype</code> now reference a new object which is a copy of <code>Foo.prototype</code>, which would have the <code>identify()</code> method on it? Why does it have to go up one more step in the prototype chain to <code>Foo.prototype</code> to find the <code>identify()</code> method?</p>
  
  <p>The official definition of <code>Object.create()</code> from the docs:</p>
  
  <blockquote>
    <p>The Object.create() method creates a new object with the specified prototype object and properties</p>
  </blockquote>