Created
January 24, 2015 16:25
-
-
Save rabidaudio/0e358f7c6692b59b90b8 to your computer and use it in GitHub Desktop.
javascript capitalize first letter of every word
This file contains 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(sentence){ | |
sentence.split(" ").map(function(e){ var a = e.split(""); a.unshift(a.shift().toUpperCase()); return a.join(""); }).join(" "); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment