Skip to content

Instantly share code, notes, and snippets.

@beatak
Created June 3, 2013 19:59
Show Gist options
  • Save beatak/5700893 to your computer and use it in GitHub Desktop.
Save beatak/5700893 to your computer and use it in GitHub Desktop.
I should keep the record of these utility functions that I implement many many times…
var lastIndexOf = function (hay, needle) {
var i = hay.split('').reverse().join('').indexOf( needle.split('').reverse().join('') );
var result = -1;
if (i > -1) {
result = hay.length - (i + needle.length);
}
return result;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment