String.lastIndexOf()
|
|
Syntax |
string.lastIndexOf(string, num) string.lastIndexOf(string)
|
|
The lastIndexOf() method returns the indexed start position of the string passed, starting from the right and going left. |
You can specify an index, defined by num in the syntax definition, to start your search for the string specified. |
This method is the same as the String.indexOf() method, but it starts at the end of the string. |
<html> <script language="JavaScript"> <!-- var myString = new String("Hello World, here I am!"); document.write(myString.lastIndexOf("e") + '<br>');
document.write(myString.lastIndexOf("l", 3));
document.close();
-->
</script> </html>
|
|
|
HTML code for linking to this page:
|
|