orb orb - 1 month ago 4x
Javascript Question

Prototypical inheritance without new or Object.create

Is there any way whatsoever to enable an object to inherit from a prototype (1) without using

, and
(2) without using
. (I had a suspicion that new is present inside the
method, but after the Firebug console told me it's native code, well, I have a suspicion it goes native.) When I say "inherit from a prototype" I mean real JavaScript prototypical inheritance (i.e, not just an imitation of it). I know real inheritance when I see it (i.e., the
property is present, there is a circular reference between the constructor and the prototype, there is an inheritance hierarchy).

My question boils down to: even though 'we barely new ya', are the only two mechanisms for inheritance


[...] are the only two mechanisms for inheritance new and Object.create?

Yes, they are. At least those are the only ones you should use.

You could directly assign to __proto__, but it is not a standard property yet. More info: MDN - __proto__.