Skip to content

Instantly share code, notes, and snippets.

@jamc92
Last active March 7, 2016 02:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamc92/371ecaa4dd7b04d951ae to your computer and use it in GitHub Desktop.
Save jamc92/371ecaa4dd7b04d951ae to your computer and use it in GitHub Desktop.
Uppercase the first letter of each word
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