Ad
Regular Expressions
Declarative Programming
Advanced Language Features
Programming Paradigms
Fundamentals
Strings

This regular expression is a little lack luster. I think it could be improved to account for hyphens and apostraphes that are supposed to be apart of a word. The objective here is to not accidentally capture punctuation mistakes.

Code
Diff
  • wordCount=s=>s.trim().match(/[A-Za-z0-9]+/mg).length;
    • wordCount=s=>s.trim().split(' ').length
    • wordCount=s=>s.trim().match(/[A-Za-z0-9]+/mg).length;