12
crisz
6y

This is the most wtf thing that happened me with Javascript, I had a regular expression and it caused bugs only with 4 digits long words, then I just noticed this:

/^.{3}$/.test(null) // false
/^.{4}$/.test(null) // true

What the fuck, I can't believe that who designed the .test method didn't think to avoid null coercion

Comments
Add Comment