Prototypes as the new class declaration

Axel Rauschmayer axel at
Wed Jun 15 00:31:25 PDT 2011

> But String.fromCharCode is not inherited such that "hi".fromCharCode delegates to String.fromCharCode. Hrm.
> I don't mean to single out String as a built-in. Whether user-defined or built-in, today's constructor functions can have "class properties" that are not inherited by instances. That seems like it could matter, e.g. to avoid having Object.keys suddenly make keys properties appear in all objects -- including in the global object!

Agreed. Ironically, having class methods also be instance methods makes things more Java-like, where all static methods can also be accessed via instances (albeit most IDEs give you a warning nowadays, but it’s legal in the language).

Dr. Axel Rauschmayer

axel at


More information about the es-discuss mailing list