Here you can find the source of wordCount(char, cs)
/**/*w ww.j av a2 s. com*/ * Returns count of requested param. * * @param {string | number} char is requested string. * @param {Boolean=} cs is case sensitive. * @return {Number} */ String.prototype.wordCount = function(char, cs) { if (cs) return this.toLowerCase().split(char.toLowerCase()).length - 1; else return this.split(char).length - 1; };
String.prototype.wordCount = function() { return this.words().length; };
String.prototype.wordCount = function(){ var result = this.words(); return result.length; };
String.prototype.wordCount = function() { return this.words().length; };
String.prototype.wordCount = function() { return this.split(/\s+/).length;
String.prototype.wordCount = function() { return this.words().length;