0

I think this works;

Obj.__proto__ = Object.__proto__

in that it passes same objects to left object. if not, please correct me.

Want to figure out how Obj.prototype

differs from Obj.__proto__

Francesco Casula
  • 26,184
  • 15
  • 132
  • 131
user2290820
  • 2,709
  • 5
  • 34
  • 62

1 Answers1

1

Obj.prototype is what you define to be a prototype of every object constructed with:

var obj = new Obj();

Obj.__proto__ is the prototype of the object that is referenced by your Obj variable itself, whatever it is (eg. Obj may be a function if it's a constructor).

Object.prototype is what will be the prototype of every object constructed with new Object().

Object.__proto__ is the prototype of the Object object itself.

But __proto__ is not standard. See Object.getPrototypeOf() for a standard way to get some object's prototype in ECMAScript 5.1 and ECMAScript 6.

rsp
  • 107,747
  • 29
  • 201
  • 177