Created
September 18, 2015 14:18
-
-
Save ceaksan/9ef5052ba40ea2bb9983 to your computer and use it in GitHub Desktop.
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 titleCase(str){ | |
str = str.toLowerCase().split(' '); | |
/* | |
str = str.toLowerCase(); | |
str = str.split(' '); | |
*/ | |
for(var i = 0; i < str.length; i++){ | |
var cF = str[i].charAt(0); | |
str[i] = str[i].replace(cF, cF.toUpperCase()); | |
} | |
return str.join(' '); | |
} | |
titleCase("I'm a little tea pot", ""); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment