MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / getWordStat

Method getWordStat

assets/js/wordCounter.js:26–32  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

24 }
25 //get wordStat() method uses a regular expression
26 getWordStat(str) {
27 let matches = str.match(/\S+/g);
28 return {
29 characters: str.length,
30 words: matches ? matches.length : 0,
31 };
32 }
33}
34
35const inputText = document.querySelector("#text");

Callers 1

countMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected