On Apr 4, 2014, at 10:22 AM, John Barton wrote:
> I was surprised to discover that in chrome at least this is valid:
> var obj = {};
> obj.__proto__ = undefined;
> but this throws
> Object.setPrototypeOf(obj, undefined);
>
> Is it intended?
Yes, see the spec at
http://people.mozilla.org/~jorendorff/es6-draft.html#sec-set-object.prototype.__proto__
It's that way because that's how __proto__ has always worked.
__proto__ is there for legacy compatibility.
setPrototypeOf should be preferred for new code
Allen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss