> Le 2 déc. 2014 à 08:46, Dmitry Soshnikov <[email protected]> a écrit 
> :
> 
> Hi,
> 
> Probably worth providing a default implementation of the `@@toStringTag` when 
> evaluating a class [1]. In this case users will be able to do:
> 
> ```
> class Point { ... }
> 
> var p = new Point(1, 2);
> console.log(p); // "[object Point]"
> ```

You seem to imply that  `console.log(p)` will show the result of `p.toString()` 
in the console. But it is not the case for the majority of browsers.

I've just tried:

```
var Point = function() {}
Point.prototype.toString = function() { return "(this is an object of type 
Point)" }
console.log(new Point)
```

Results are:

Firefox: Object { }
Chrome: Point{toString: function}
Safari: Object
IE: [object Object]    (this is an object of type Point)

In particular, note that Chrome doesn't need the help of `.toString()` in order 
to log useful information.

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

Reply via email to