Skip to content

Commit 3ff7d61

Browse files
committed
white space in array fixed
1 parent 7466fd6 commit 3ff7d61

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

word-counter/script.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ const count = () => {
1010
lettercount.innerText = textarea.value.length;
1111
let letter = textarea.value;
1212
word = letter.trim().split(" ");
13-
let filtered = word.filter(function (el) {
14-
return el != null || " ";
13+
let filtered = word.filter(function (element) {
14+
return element !== "";
1515
});
16-
console.log(filtered);
1716

18-
wordcount.innerText = filtered.length;
17+
console.log(filtered);
1918

19+
wordcount.innerText = filtered.length;
2020
};

0 commit comments

Comments
 (0)