Skip to content

Instantly share code, notes, and snippets.

@heimdallrj
Last active July 27, 2017 10:30
Show Gist options
  • Save heimdallrj/41c327147010526694a73bcd729acda7 to your computer and use it in GitHub Desktop.
Save heimdallrj/41c327147010526694a73bcd729acda7 to your computer and use it in GitHub Desktop.
toTitleCase(str: string) {
console.log('str: ', str);
return str.toLowerCase().split(' ').map(function(word) {
return (word.charAt(0).toUpperCase() + word.slice(1));
}).join(' ');
}
https://medium.freecodecamp.org/three-ways-to-title-case-a-sentence-in-javascript-676a9175eb27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment