Object.assign()

Herby Vojčík herby at mailbox.sk
Thu Oct 18 03:25:40 PDT 2012



Axel Rauschmayer wrote:
> Addendum: For example, you won’t be able to reliably use Object.assign()
> to mix an object with methods into a prototype object, because those
> methods might be non-enumerable.

That's wrong use of Object.assign. Remember the debate on :=, there is 
intent distinction between [[Put]] and [[DefineOwnProperty]]. And 
Object.assign, if I am not mistaken, does [[Put]]. For copying methods, 
you should do [[DefineOwnProperty]] (that is, Object.define, if it is 
there).

> --
> Dr. Axel Rauschmayer
> axel at rauschma.de <mailto:axel at rauschma.de>

Herby


More information about the es-discuss mailing list