Skip to content

Instantly share code, notes, and snippets.

@guumaster
Created October 27, 2015 15:10
Show Gist options
  • Save guumaster/1949343af406129489a8 to your computer and use it in GitHub Desktop.
Save guumaster/1949343af406129489a8 to your computer and use it in GitHub Desktop.
'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;
@IGZalejandrocuerdo
Copy link

function capitalizeWord(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}

module.exports = {capitalizeWord};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment