RegExp lastIndex Mutates Global Matches?!

Global regex has MEMORY! The lastIndex property remembers where it stopped. Reset it to 0 and the same regex matches DIFFERENTLY. This mutation behavior will cause bugs you'll never find!

#javascript #javascripttricks #regexp #lastindex #globalregex #javascriptweird #javascriptquiz #codingchallenge #javascriptshorts #javascriptwtf #regexmutation #advancedjavascript

https://www.youtube.com/watch?v=R9Oos0uu-BQ

RegExp lastIndex Mutates Global Matches?! #javascriptshorts

YouTube