The indexOf() function of string object returns the index of the first occurrence of the specified substring, or -1 if not found. The indexOf() method is case sensitive.Use it for example to search substring within string object.
Syntax