title: Clarifying javascript prototype nomenclature and mechanism
body: <p>Recognizing that JavaScript doesn't have the concept of class per se, and that the "type" of all objects is "object", I'm trying to get my head around just what a "prototype" consists of and, in particular, how its "name" is associated with it. For example, in the following:</p>
  
  <pre><code>function Foo(){};
  console.log(Foo.prototype);                // =&gt; "Foo {}"
  </code></pre>
  
  <p>How does <code>console.log</code> know to output <code>Foo</code> before the braces and what is that name referring to?</p>
  
  <p>(Note: I'm aware that in the above, I'm referring to the prototype property of functions and not the prototype per se (i.e. not the thing accessible by <code>__proto__</code>), but the same question applies to the actual prototype objects. I just used the prototype property to simplify my example.)</p>
  
  <p>Update: Based on the comment thread, this question is really focused on what Chrome is doing and, in particular, rationalizing its behavior in the following:</p>
  
  <pre><code>function Foo(){};
  Foo.prototype.constructor = function Bar(){};
  f = new Foo();
  console.log(f);              // =&gt; Foo{} (remembering that f created by Foo, ignoring constructor)
  console.log(Foo.prototype)   // =&gt; Bar{} (reporting constructor value)
  </code></pre>
  
  <p>See <a href="https://gist.github.com/getify/5793213" rel="nofollow">https://gist.github.com/getify/5793213</a> for more discussion.</p>