Javascript - String.lastIndexOf()

Syntax

string.lastIndexOf(string, num)
string.lastIndexOf(string)

Description

The lastIndexOf() method of an instance of the String object returns the indexed start position of the string passed, starting from the right and going left. Additionally, 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.

Example

<script language="JavaScript">
<!--

var myString = new String("Hello me!");

document.write(myString.lastIndexOf("e")); //result is 7
document.write(myString.lastIndexOf("l", 3)); //result is 3 //--> </script>
Write a review
Message:
Rating:
Name:
Email:
(optional)
(Your email that entered here will not show anywhere on website and will use only reference when someone reply your post)
  I want to receive a copy of email on this post (your email is needed)
 
Code: