Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong><code>Object</code> is Eve, and <code>Function</code> is Adam, Adam (<code>Function</code>) uses his bone (<code>Function.prototype</code>) to create Eve (<code>Object</code>). Then who created Adam (<code>Function</code>)? -- The Inventor of the JavaScript language :-).</strong></p> <p>According to utsaina's answer, I want to add more useful info.</p> <blockquote> <p>The most surprising thing for me was discovering that <code>Object.__proto__</code> points to <code>Function.prototype</code>, instead of <code>Object.prototype</code>, but I'm sure there's a good reason for that :-)</p> </blockquote> <p>It should NOT be. <code>Object.__proto__</code> should NOT point to <code>Object.prototype</code>. Instead, the instance of <code>Object</code> <code>o</code>, <code>o.__proto__</code> should point to <code>Object.prototype</code>.</p> <p>(Forgive me for using the terms <code>class</code> and <code>instance</code> in JavaScript, but you know it :-)</p> <p>I think the class <code>Object</code> itself is an instance of <code>Function</code>, that's why <code>Object.__proto__ === Function.prototype</code>. Therefore: <code>Object</code> is Eve, and <code>Function</code> is Adam, Adam (<code>Function</code>) uses his bone (<code>Function.prototype</code>) to create Eve (<code>Object</code>).</p> <p>Furthermore, even the class <code>Function</code> itself is an instance of <code>Function</code> itself, that is <code>Function.__proto__ === Function.prototype</code>, that's also why <code>Function === Function.constructor</code></p> <p>Further furthermore, the regular class <code>Cat</code> is an instance of <code>Function</code>, that is <code>Cat.__proto__ === Function.prototype</code>.</p> <p>The reason for the above is, when we create a class in JavaScript, actually, we are just creating a function, which should be an instance of <code>Function</code>. <code>Object</code> and <code>Function</code> are just special, but they are still classes, while <code>Cat</code> is a regular class.</p> <p><strong>As a matter of factor, in Google Chrome JavaScript engine, the following 4:</strong></p> <ul> <li><code>Function.prototype</code></li> <li><code>Function.__proto__</code></li> <li><code>Object.__proto__</code></li> <li><code>Cat.__proto__</code></li> </ul> <p>They are all <code>===</code> (absolutely equal) to the other 3, and their value is <code>function Empty() {}</code></p> <pre><code>&gt; Function.prototype function Empty() {} &gt; Function.__proto__ function Empty() {} &gt; Object.__proto__ function Empty() {} &gt; Cat.__proto__ function Empty() {} &gt; Function.prototype === Function.__proto__ true &gt; Function.__proto__ === Object.__proto__ true &gt; Object.__proto__ === Cat.__proto__ true </code></pre> <p>OK. Then who creates the special <code>function Empty() {}</code> (<code>Function.prototype</code>)? Think about it :-)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload