METHODOLOGY/ FORMULA
Word Counter Methodology
Word counting
Words are counted by trimming leading/trailing whitespace, then splitting on any remaining whitespace:
words = text.trim().split(/\s+/).length
Character counting
- Total characters:
text.length - Characters without spaces:
text.replace(/\s/g, "").length
Sentences and paragraphs
Sentences are detected by terminal punctuation (. ! ? …) followed by whitespace or end of string. Paragraphs are separated by double line breaks.
Reading time
Reading time assumes 200 words per minute (WPM), a widely cited average for adult silent reading. minutes = words / 200, rounded up.