Skip to content

Commit 71d2474

Browse files
committed
countWords
1 parent 842cf9f commit 71d2474

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// 1. Count Words of a String
2+
3+
// 1. Using split() Method
4+
5+
{
6+
const count = (s) => s.trim().split(/\s+/).length;
7+
8+
const s = "Hello, this is a simple test";
9+
console.log(count(s));
10+
}

0 commit comments

Comments
 (0)