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

Sample Javascript

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

2 thought on “count function for Javascript”

Leave a Reply