There was an error while loading. Please reload this page.
1 parent 3f524bb commit 4dff23eCopy full SHA for 4dff23e
6_Title-Case/index.js
@@ -0,0 +1,14 @@
1
+// Title Case
2
+// Write a function that takes in a string (sentence) and capitalizes the first letter of each word
3
+
4
+const titleCase = str => {
5
+ return str
6
+ .split(' ')
7
+ .map(word => {
8
+ return word.replace(word[0], word[0].toUpperCase())
9
+ })
10
+ .join(' ')
11
+}
12
13
+console.log(titleCase('I am a coding guru'))
14
+console.log(titleCase('Everyone want to work at Google'))
0 commit comments