This snippet will give you the contains function for Javascript.

Sample Javascript

String.prototype.contains = function(text) {
	return (this.indexOf(text) !== -1);
};

2 thought on “contains function for Javascript”

Leave a Reply