Created
March 24, 2018 18:12
-
-
Save dragonza/6d286f2e176cde6832101c3cc308db55 to your computer and use it in GitHub Desktop.
Sentence Capitalization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function capitalize(str) { | |
let result = ''; | |
for (let word of str.split(' ')) { | |
result += word[0].toUpperCase() + word.slice(1) + ' '; | |
} | |
return result.trim(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment