Being fairly new to JavaScript, I'm unable to discern when to use each of these.
Can anyone help clarify this for me?
If you require a regular expression, use search(). Otherwise, indexOf() is going to be faster.
search()
indexOf()
2.1m questions
2.1m answers
60 comments
56.9k users