(str)
| 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 | |
| 35 | const inputText = document.querySelector("#text"); |