Checks if the first argument string ends with a specific string (second argument string). If the string is not found, return -1.
String
indexOf(<parameters>)
Parameter | Type |
---|---|
string | String |
specified value | String |
indexOf(<string>,<string>)
Returns an integer.
indexOf("Hello", "l")
Returns 2.
Explanation:
In “Hello”, the first occurrence of “l” is at position 2.