`new Object` vs `Object` difference

Benjamin Gruenbaum benjamingr at gmail.com
Mon Jun 15 12:28:53 UTC 2015

Pointing out that I'm replying to a message with an empty subject - using
the correct original title here

---------- Forwarded message ----------
From: Rock <zloirock at zloirock.ru>
Benjamin Gruenaum, Andrea Giammarchi, you are wrong about RegExp:
var re = /./;
new RegExp(re) === re; // false
RegExp(re) === re; // true

Nice catch. This is states explicitly as a difference to the rule here

> If pattern is an object R whose [[Class]] internal property is "RegExp"
and flags is undefined, then return R unchanged. Otherwise call the
standard built-in RegExp constructor ( as if by the expression
new RegExp( pattern, flags) and return the object constructed by that

I didn't notice that - thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150615/161400fc/attachment.html>

More information about the es-discuss mailing list