andrea.giammarchi at gmail.com
Mon Jun 15 11:36:47 UTC 2015
that's no how usually you create RegExp
new RegExp('yep', 'g');
both will produce similar RegExp instances (every time a new one).
Using the RegExp constructor as RegExp wrapper is a very unusual pattern I
haven't seen before. So yes, in that case we have some sort of unusual
behavior that yet makes little sense to me because `RegExp.length` is 2 and
you are potentially ignoring the second argument
TypeError: Cannot supply flags when constructing one RegExp from another at
So beside creating a `new RegExp` from another `RegExp` knowing what you
are doing is the only pattern I can think of that might make sense (in
terms of having index and stuff reset ... if that's even the case)
Good spot though.
On Mon, Jun 15, 2015 at 8:37 AM, Rock <zloirock at zloirock.ru> wrote:
> Benjamin Gruenaum, Andrea Giammarchi, you are wrong about RegExp:
> var re = /./;
> new RegExp(re) === re; // false
> RegExp(re) === re; // true
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss