String.prototype.lastIndexOf() Method in String Class of Javascript Syntax with Examples
2450 Views
Usage
lastIndexOf() return the last occurence position of element in the elements.
Syntax
String.lastIndexof("element")
Example
var userName = "Steve smith";
//Returns the last occurence the position of the element
var char1 = userName.lastIndexOf("t");
document.write("The element position is "+char1+" in the string.");