Returns the position (in the first argument) of the last occurrence of the second parameter. Returns -1 if there is no match.
String
lastIndexOf(<parameters>)
Parameter | Type |
---|---|
string | String |
specified value | String |
lastIndexOf(<string>,<string>)
Returns an integer.
lastIndexOf("Hello", "l")
Returns 3.
Explanation:
In “Hello”, the last occurrence of “l” is at position 3.