The purpose of this assignment is to practice JavaScript programming.
Within code.js, the function getStats(txt)
reads textual input and computes statistical information for the given input. The results are as follows:
nChars
: the total number of characters in the text, including all whitespacesnWords
: the total number of words in the textnLines
: the number of lines in the textnNonEmptyLines
: the number of lines in the text containing at least one visible character (any non-whitespace character)maxLineLength
: the length of the longest line, including any trailing whitespace except newlines '\n'averageWordLength
: the average word length in the textpalindromes
: a list of unique palindromes in the textlongestWords
: the 10 longest words in the text - in the case of ties, the secondary sorting criteria is alphabetically sortedmostFrequentWords
: the 10 most frequent words of the text, concatenated with the respective frequencies - again, ties are resolved by alphabetical sorting
Note that code.js is authored by Moonis Ahmed - the original repo is authored by Pavol Federl.
Originally developed for W2017 SENG513: Web Based Systems