Javascript String endsWith() method
endsWith()
String.prototype.endsWith = function () { var suffix = arguments[0]; return this.indexOf(suffix, this.length - suffix.length) !== -1; };