JavaScript String method: indexOf()
[this page | pdf | back links]
The indexOf() method (when applied to a JavaScript
string)
returns the position of the first occurrence of a specified string in the
string. It is case-sensitive. It returns -1 if the string being searched for is
not found.
It
has the following syntax with the following parameters:
string.indexOf(searchstring, start)
|
Parameter
|
Required / Optional
|
Description
|
|
searchstring
|
Required
|
String to be searched
for
|
|
start
|
Optional
|
(Default is 0). Position at which to start
search
|
NAVIGATION LINKS
Contents | Prev | Next | JavaScript String Variables