很多时候我使用字符串match函数来知道字符串是否与正则表达式匹配.
match
if(str.match(/{regex}/))
这有什么区别:
if (/{regex}/.test(str))
他们似乎给出了相同的结果?
javascript regex performance
javascript ×1
performance ×1
regex ×1