Object.assign and __proto__ property

Rick Waldron waldron.rick at gmail.com
Sat Oct 19 07:55:01 PDT 2013


On Sat, Oct 19, 2013 at 10:25 AM, teramako <teramako at gmail.com> wrote:

> Hi
>
> I believe Object.assign never update the target's [[prototype]]. But
> current rev19 spec is using Put. So I'm afraid of following case will
> update the [[prototype]].
>
> var soruce = {};
> Object.defineProperty(source, "__proto__", {
>     value: { a: "A", b: "B" },
>     enumerable: true
> });
> var target = {};
> Object.assign(target, source);
>
> Is this expected result ? and is there a plan to change to
> DefinePropertyOrThrow from Put ?
>

Object.assign is essentially a "batch property assignment with Put"; I
believe what you're describing above is Object.mixin, which is "batch
property definition with DefinePropertyOrThrow".

Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131019/c3a5cdf1/attachment.html>


More information about the es-discuss mailing list