as always with these posts, the secret is implicit type coercion. {} converted to a string is "[object Object]". Regex expects a string. JS makes sure it gets one by feeding the console log representation of whatever garbage non-string data you gave it.
View all comments
Show parent comment
3
u/Andersmith Mar 20 '24
as always with these posts, the secret is implicit type coercion. {} converted to a string is "[object Object]". Regex expects a string. JS makes sure it gets one by feeding the console log representation of whatever garbage non-string data you gave it.