That's the trick, it always makes sense once it's explained. How long would it take you to reason towards that explanation on your own? You'd need to know how objects are coerced to string and how square brackets work in regex. And where to start looking.
And like I'm a big advocate for basic regex competency, which I do feel this falls under. But also in my experience most devs don't have basic regex competency.
View all comments
Show parent comment
1
u/thirdegree Violet security clearance Mar 21 '24
But js isn't predictable, to anyone with less than an expert understanding of js type conversion rules. To anyone else, it makes very little sense.