contains function for Javascript

This snippet will give you the contains function for Javascript.

Sample Javascript

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

Please Share us:
Please rate this snippet

2 thoughts on “contains function for Javascript

Leave a Reply