Created
May 21, 2015 03:28
-
-
Save omni5cience/04252f228b322d5c9a50 to your computer and use it in GitHub Desktop.
Wat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var wat = /.+/g; | |
wat.test(undefined); // true | |
wat.test(undefined); // false | |
wat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I forgot to update this at the time, but the answer is that global
RegExp
s (i.e. those with/g
) are stateful.We can observe this by looking at
wat.lastIndex
.