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.
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss