Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5dfc684

Browse files
author
Coding Money
committed
title case solution
1 parent 513c4f1 commit 5dfc684

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

‎completed_exercises/5-titlecase.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77
// capitalize('what is titlecase?') --> 'What Is Titlecase?'
88
// capitalize('titles of books, movies, songs, plays and other works') --> 'Titles Of Books, Movies, Songs, Plays And Other Works'
99

10-
function capitalize(str) {}
10+
function capitalize(str) {
11+
const words = str.split(' ')
12+
//['this', 'is', 'mukhtar'..]
13+
14+
15+
return words.map(word => word[0].toUpperCase() + word.slice(1)).join(' ')
16+
17+
}
1118

1219

1320
console.log(capitalize('this is mukhtar from coding money'));

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /