This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Takes the given HTML data, replaces all its HTML tags with nothing, splits the result by spaces, | |
* and outputs the array length i.e. number of words. | |
* | |
* @param string htmlData HTML Data | |
* @return int Word Count | |
*/ | |
function GetWordCount(htmlData) { | |
return htmlData.replace(/<(?:.|\s)*?>/g, '').split(' ').length; | |
} |
NewerOlder