Menu
Coddy logo textTech

26. Count Words

Lesson 27 of 31 in Coddy's 30 Days of Logic Building in Javascript course.

challenge icon

Challenge

Easy

Write a function that counts the number of words in a sentence.

  • Input: <strong>"Hello, how are you today?"</strong>
  • Expected Output: <strong>5</strong>

Try it yourself

function countWords(sentence) {
    // write your code below 
    
}

All lessons in 30 Days of Logic Building in Javascript