what is the easiest way to figure out if a string ends with a certain value?
Stolen from prototypejs:
String.prototype.endsWith = function(pattern) { var d = this.length - pattern.length; return d >= 0 && this.lastIndexOf(pattern) === d; }; 'slaughter'.endsWith('laughter'); // -> true