Proposal: allow primitives to be explicitly returned from constructors
Oriol _
oriol-bugzilla at hotmail.com
Thu Apr 19 23:22:35 UTC 2018
This would break one of my most preferred ways to check whether a value is an object:
```js
function isObject(value) {
return value === new function(){ return value };
}
```
Unlike `Object(value) === value`, the above is just syntactic, it does not require `Object` to be the built-in one.
And I don't really see the point, constructors are supposed to construct objects. If you want primitives, you can always use function calls.
-- Oriol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180419/b6cb6046/attachment.html>
More information about the es-discuss
mailing list