B.3.1 The __proto__ pseudo property

Brandon Benvie bbenvie at mozilla.com
Wed May 8 09:17:11 PDT 2013


On 5/8/2013 9:00 AM, David Bruant wrote:
> Le 08/05/2013 16:46, Andreas Rossberg a écrit :
>> Isn't Object.create the proper alternative to both {__proto__: } and
>> triangle for objects? What has setPrototypeOf got to do with it? (And
>> why is that on the table all of a sudden?)
> Object.create only creates "normal" objects, not arrays, functions, 
> dates, etc.

Same is true of `__proto__` in object literals.

The benefit of `__proto__` in literals is the succinctness of it. Using 
`Object.create` to create new objects requires using descriptors which 
are horribly verbose.


     Circle.prototype = {
       __proto__: Shape,
       constructor: Circle,
       /* etc. */
     };

This becomes much less important with classes.


More information about the es-discuss mailing list