Skip to content

Instantly share code, notes, and snippets.

Last active May 10, 2019
What would you like to do?
function capitalizeSentence(str) {
return str.replace(/^\w|(\s\w)/g, function(match, index) {
return match.toUpperCase()
capitalizeSentence('Lorem ipsum dolor sit amet, consectetur adipiscing elit.');
// "Lorem Ipsum Dolor Sit Amet, Consectetur Adipiscing Elit."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment