is this possible?
My thinking: Prototypes are essentially attributes of the Constructor function (whether native Constructor such as Function, String or Object, or your own custom Constructor) and only the ‘new’ keyword is able to leverage the Constructor and its prototype for object creation
Am I missing something?
You are right, but now in the ECMAScript 5th Edition, the
Object.createmethod is able to create object instances using another objects as a prototype:In the above example,
objwill be created and it will contain a reference toprotoin the[[Prototype]]internal property, and:This method is from the new specification approved on December 2009, as far I’ve seen now is available on the Mozilla JavaScript 1.9.3 implementation.
For now you can mimic the behavior of that method by this, as proposed by Douglas Crockford: