My read of section 12.8.3.1 
(https://tc39.github.io/ecma262/#sec-addition-operator-plus-runtime-semantics-evaluation),
is that V8 is getting this right.

ToPrimitive on `{}` will, by default, return “[object Object]” — We first call 
`Object.prototype.valueOf()`, which returns `this` (see 19.1.3.7). Following 
this, we call `toString()`, and get “[object Object]”.

Subsequent steps of the algorithm just concatenate the two strings together. So 
it looks like the other vendors are getting this wrong?

> On Apr 13, 2016, at 10:20 AM, Michał Wadas <[email protected]> wrote:
> 
> Short question - code
> {}+{}
> V8 result: "[object Object][object Object]"
> Safari, Firefox, Edge: NaN
> 
> Which one is correct?
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to