Why ES6 introduced classes yet `Symbol` not to be used with `new`?
Oriol Bugzilla
oriol-bugzilla at hotmail.com
Sun Aug 14 22:58:28 UTC 2016
Probably, because symbols are primitive values, and constructors only create and initialize objects.
So you are supposed to call it as a function instead of as a a constructor.
That said, it might make sense for `new Symbol()` to return a symbol object. But instead, you can use
```javascript
Object(Symbol());
```
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160814/96f12dbd/attachment.html>
More information about the es-discuss
mailing list