Set#toString and Map#toString

Boris Zbarsky bzbarsky at
Thu Sep 4 17:08:04 PDT 2014

On 9/4/14, 5:51 PM, C. Scott Ananian wrote:
>> s.toString()
> '[object Object]'

Per spec this should be "[object Set]".  Both V8 and SpiderMonkey get 
this right, fwiw.

>> m.toString()
> '[object Object]'

Again, should be "[object Map]".

> Eventually node's `util.inspect` (and the various browser analogs)
> will presumably learn about `Map` and `Set`.  But the latest Chrome
> beta still reports:
> ```js
>> s = new Set(['a'])
> < Set {}

Firefox reports:

   Set [ "a" ]


More information about the es-discuss mailing list