match 和 lastIndex 字符串檢測差別

  • match 、replace 、search 這寫不能識別特殊字符
  • indexOf 、indexof 能識別特殊字符
str.lastIndexOf('a') > -1 // 經過lastIndexOf 能夠檢測特殊字符,尤爲*、.、+等
相關文章
相關標籤/搜索