Are inline JavaScript regular expressions faster?

后端 未结 3 1607
醉梦人生
醉梦人生 2021-01-05 07:09

Is it better to use the RegExp object or the inline style? And why?

3条回答
  •  半阙折子戏
    2021-01-05 07:19

    "The RegExp() method allows you to dynamically construct the search pattern as a string, and is useful when the pattern is not known ahead of time." -http://www.javascriptkit.com/jsref/regexp.shtml

提交回复
热议问题