We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1e7689f commit a251adcCopy full SHA for a251adc
21.GetWordCount.js
@@ -0,0 +1,12 @@
1
+// Get Word Count
2
+
3
+// Create a function that takes a string and returns the word count. The string will be a sentence.
4
5
+function getWordCount(str) {
6
+ return str.split(" ").length
7
+}
8
9
+//inputs
10
+console.log(getWordCount("Just an example here move along")) // 6
11
+console.log(getWordCount("This is a test")) // 4
12
+console.log(getWordCount("What an easy task, right")) // 5
0 commit comments