Created
October 27, 2015 15:10
-
-
Save guumaster/1949343af406129489a8 to your computer and use it in GitHub Desktop.
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
'use strict'; | |
let convert = (str) => { | |
return str | |
.trim() | |
.split(/ +/) | |
.reduce((acc, word) => { | |
return (acc + ' ' + word[0].toUpperCase() + word.slice(1).toLowerCase()).trim(); | |
}, ''); | |
} | |
module.exports = convert; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
function capitalizeWord(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
module.exports = {capitalizeWord};