SYNTAX – string.indexOf(searchValue, start)
The string represents the given string to be checked on.
searchValue – required value to search for
start – The position from where to start. It is an optional field. If start<0, the search starts from the back of the string i.e. start+string length is used.
The method returns the first position where the value exists. It returns -1 if the value never occurs. The method compares the search Value with elements of the array or string using strict equality. In arrays, if the slots are empty, it skips them.
indexOf() is an ESI feature and it is supported by all browsers.
For Example –