Last active
March 7, 2016 02:40
-
-
Save jamc92/371ecaa4dd7b04d951ae to your computer and use it in GitHub Desktop.
Uppercase the first letter of each 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 myUpperCase(str) { | |
split = str.split(' '); | |
for (var i = 0; i < split.length; i++) { | |
split[i] = split[i].charAt(0).toUpperCase() + split[i].slice(1); | |
} | |
capitalizeString = split.join(' '); | |
return capitalizeString; | |
} | |
myUpperCase("how are you"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment