#whyglobals — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #whyglobals, aggregated by home.social.
-
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec
> JavaScript RegExp objects are stateful when they have the global or sticky flags set (e.g. /foo/g or /foo/y). They store a lastIndex from the previous match.
Look on, and weep, for we have entered the realm of client-side PHP.
Early-aborting a RegExp.exec-based loop – and lazy evaluation's the only thing this is useful for – without manually resetting an internal property will cause subtle bugs that are hard to spot.