The search() method searches the string for the specified value and returns its position of the match. The search value can be the string or regular expression. The search method returns -1 if no match is found.
Javascript String search() is an inbuilt function that executes the search for a match between a regular expression and this String object.
The syntax of the JavaScript string search() method is the following.
string.search(searchvalue)
#javascript #javascript string search #js