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()

Javascript String search() is an inbuilt function that executes the search for a match between a regular expression and this String object.

Syntax

The syntax of the JavaScript string search() method is the following.

string.search(searchvalue)

#javascript #javascript string search #js

Javascript String Search: How to Search String in JavaScript
1.80 GEEK