![]() |
VOOZH | about |
The lastIndexOf() is an inbuilt function in TypeScript which is used to get the index within the calling String object of the last occurrence of the specified value.
Syntax:
string.lastIndexOf(searchValue[, fromIndex])
Parameter: This method accepts two parameter as mentioned above and described below:
Return Value: This method returns the index of the last found occurrence, otherwise -1 if not found.
Example 1:
Output:
17
Example 2:
Output:
-1