Here you can find the source of wordCount()
String.prototype.wordCount = function () { var initialBlanks = /^\s+/; var leftTrimmed = this.replace(initialBlanks, ""); var words = leftTrimmed.split(/\s+/); // The resulting array may have an empty last element which must be removed if (!words[words.length-1]) words.pop(); return words.length; };
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;