Saturday, January 12, 2019

javascript - What is the difference between indexOf() and search()?



Being fairly new to JavaScript, I'm unable to discern when to use each of these.




Can anyone help clarify this for me?


Answer



If you require a regular expression, use search(). Otherwise, indexOf() is going to be faster.


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...