1 line of code: How to count the words in a string
const countWords = str =&gt; str.trim().split(/\s+/g).length;        Enter fullscreen mode          ...
Tags: javascript, webdev, productivity, codequality