JavaScript String search()
JavaScript String search()
The search() method is used to match a string against a regular expression. It returns the index of the first matched result else it will return -1. This method is case-sensitive.
Syntax:-
Its syntax is:- string.search(searchValue)
Return:-
Its return is:- position of the first match else -1
Further Explanation:-
Parameter | Description |
searchValue | Required. The search value or a regular expression. |