This snippet will give you the EndsWith function for Javascript.

Sample Javascript

String.prototype.endsWith = function(text) {
	return (this.indexOf(text) === (this.length-text.length));
};

2 thought on “EndsWith function for Javascript”

Leave a Reply