1
var myArray = [];
console.dir(myArray);

Returns __proto__ not prototype:

enter image description here

console.dir(Array);

Return both prototype and __proto__ but but opposite than above.

enter image description here

  • In first case: __proto__ has concat, constructor, etc.
  • In second case: prototype has concat, constructor, etc.

So, why is this returning different results?

Navin Rauniyar
  • 10,127
  • 14
  • 45
  • 68
  • 1
    Because the first is an instance, and the second the constructor function (or "class" if you want) – Bergi Jun 04 '14 at 03:26
  • 1
    `Array._proto_` === Function.prototype and `myArray._proto_` === Array.prototype. Why? Because myArray is an instance of Array so Array's prototype === `myArray._proto_`. The prototype of Array is the first used in the prototype chain for myArray. Array is an instance of Function so `Array._proto_` === Function.prototype. That is why you can do `Array.call({})` (not that that does anything) For more info about constructor functions and prototype see here: http://stackoverflow.com/a/16063711/1641941 – HMR Jun 04 '14 at 05:29

0 Answers0