loading...

re: What’s your alternative solution? Challenge #36 VIEW POST

FULL DISCUSSION
 

Here's a one liner answer using regex

const countWords = (text) => (text.match(/\b\w+\b/g) || []).length
code of conduct - report abuse