Default @@toStringTag for user classes

Andrea Giammarchi andrea.giammarchi at
Tue Dec 2 04:15:44 PST 2014

Same question here.

AFAIK usually the `({} === "[object Object]")` check
is the `default:` in a switch, the last `else` in a flow, etc etc ...
although I wouldn't be surprised if some code, somewhere, would do strict
comparison to know if it's a user defined object or not. In that case there
will be problems.

To be honest I also don't see much advantage in having this configurable
when `obj.constructor.displayName` or `` can be checked
instead and eventually fallback into ``

This will work backward compatible too


On Tue, Dec 2, 2014 at 12:03 PM, Claude Pache <claude.pache at>

> Le 2 déc. 2014 à 09:04, Michał Wadas <michalwadas at> a écrit :
> It probably would be backward incompatible change. Too much code depends
> on [Object Object].
> I'm curious to know what sort of code would be broken by
> ` === "[object Point]"` for instances `x` of some
> user-defined class? and whether it is not already broken by, say,
> ` Set) === "[object Set]"`?
> —Claude
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list