TypeScript String lastIndexOf() - TypeScript

What is TypeScript - String lastIndexOf()?

This method returns the index within the calling String object of the last occurrence of the specified value, starting the search at fromIndex or -1 if the value is not found.


Argument Details

  • searchValue − A string representing the value to search for.
  • fromIndex − The location within the calling string to start the search from. It can be any integer between 0 and the length of the string. The default value is 0.

Return Value

Returns the index of the last found occurrence, otherwise -1 if not found.


On compiling, it will generate the same code in JavaScript.

Its output is as follows −

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

TypeScript Topics