Javascript String endsWith(value)
// Extension method endsWith for string object String.prototype.endsWith = function (value) { return this.indexOf(value, this.length - value.length) != -1; };
String.prototype.endsWith = function(value) { if (!value)/* w w w . ja va2 s.c o m*/ return false; if (value.length > this.length) return false; var end = this.substring(this.length - value.length); return end === value; };