es-discuss Digest, Vol 52, Issue 161

Axel Rauschmayer axel at rauschma.de
Tue Jun 28 16:22:52 PDT 2011


> Plus, the prototype is in some ways secondary. It's the less directly used object when one calls a constructor often, after populating the prototype. And if class methods come into the picture, the prototype is even more "backstage", an implementation detail.


That seems to be a matter of taste: To me prototypes are the core of JavaScript inheritance. The single construct that is used to handle both instance-of and subclass-of. If you draw an object diagram, it is constructors that move into the background and prototypes that remain.

What do you do with constructors-as-classes to check the following?
        o instanceof C
You look for C.prototype in the prototype chain of o.

Axel

-- 
Dr. Axel Rauschmayer

axel at rauschma.de
twitter.com/rauschma

home: rauschma.de
blog: 2ality.com





More information about the es-discuss mailing list