Skip to content

Instantly share code, notes, and snippets.

@unknownuser88
Created January 6, 2014 13:24
Show Gist options
  • Save unknownuser88/8282836 to your computer and use it in GitHub Desktop.
Save unknownuser88/8282836 to your computer and use it in GitHub Desktop.
lastIndexOf(substr, [start]) Searches and (if found) returns the index number of the searched character or substring within the string. Searches the string from end to beginning. If not found, -1 is returned. “Start” is an optional argument specifying the position within string to begin the search. Default is string.length-1.
//lastIndexOf(substr, [start])
var myString = 'javascript rox';
console.log(myString.lastIndexOf('r'));
//output: 11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment