count function for Javascript

This code snippet will give you the count funtion for Javascript.

Sample Javascript

String.prototype.count = function(input) {
	return this.split(input).length-1;
};

Please Share us:
Please rate this snippet

2 thoughts on “count function for Javascript

Leave a Reply