There was an error while loading. Please reload this page.
1 parent 4b8b2a0 commit 0c95f6bCopy full SHA for 0c95f6b
word_count.js
@@ -0,0 +1,11 @@
1
+const word = "this is a word";
2
+let count = 0;
3
+for (let i = 0; i < word.length; i++) {
4
+ let char = word[i];
5
+ if (char == " " && word[i - 1] != " ") {
6
+ count++;
7
+ }
8
+ // console.log(word[i]);
9
+}
10
+count++;
11
+console.log(count);
0 commit comments