Challenge: Helpers

Try completing this exercise related to helpers.

Problem statement

We have to count the number of words in the band descriptions so that people don’t write novels. We also want to show them how many words they’ve written. Write a template helper called words-in that counts the words in a string passed to it. Whitespace and punctuation are not considered words, and empty values, including null and undefined, should be considered as having a length of zero.

Coding exercise

Write your code below. I recommend that you try solving the exercise yourself before viewing the solution.

Good luck!

Get hands-on with 1200+ tech skills courses.