"You could stare at that function for hours without seeing
the problem. It requires knowledge of how JavaScript’s
String.replace() works:"
Okay, but "knowledge of how JavaScript's String.replace() works" is showing that the experience of those guys is not the greatest. I'm pretty sure every decent JS developer knows this after a short amount of time, because "String.replace" is used pretty often.