Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

word count js

    function calculateWordCount(text) {
        const wordsArr = text.trim().split(" ")
        return wordsArr.filter(word => word !== "").length
    }
Source by scrimba.com #
 
PREVIOUS NEXT
Tagged: #word #count #js
ADD COMMENT
Topic
Name
4+6 =