Easy

JavaScript Word Counter Not Handling Multiple Spaces and Punctuation Correctly

You are building a feature where a user can input text, and the app will count the number of words. You need to improve the word counting function, but there's an issue with how the input is being processed. What’s the problem with this code?

Choose an option below