Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I know this post is kind of old, but I've been searching the net for information on this subject and figured I'd post what I found. The prototype property is for constructor functions. It allows you to assign the prototype object of objects you will create with the new keyword.</p> <p>Every object in JavaScript has a prototype object, but many implementations don't give you direct access to it or allow you to set it after object creation. In FireFox, you can access this object via the "<code>__proto__</code>" property.</p> <p>Below I have a version of your code using the "<code>__proto__</code>" property. The section on the Function prototype chain matches what you thought it should have been.</p> <pre><code>function nl(z) { document.write(z + "&lt;br&gt;"); } x = {}; nl(x["__proto__"]); nl(x["__proto__"] === Object.prototype); nl(""); nl(nl.prototype.constructor); nl(nl["__proto__"].constructor); nl(nl["__proto__"] === nl.prototype); nl(""); nl(nl["__proto__"]); nl(nl["__proto__"] === Function.prototype); nl(nl["__proto__"]["__proto__"] === Object.prototype); nl(nl["__proto__"]["__proto__"]["__proto__"]); nl(""); nl(Function["__proto__"]); nl(Function["__proto__"]["__proto__"]); nl(Function["__proto__"]["__proto__"] === Object.prototype); nl(Function["__proto__"]["__proto__"]["__proto__"]); </code></pre> <p>Output in FireFox is:</p> <pre><code>[object Object] true function nl(z) { document.write(z + " "); } function Function() { [native code] } false function () { } true true null function () { } [object Object] true null </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    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