Created
October 11, 2017 06:18
-
-
Save monis01/ebc2e09f306011d9ee8c6e008566971d to your computer and use it in GitHub Desktop.
Caps Each Letter In The Sentense
This file contains hidden or 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
//@ changing values like 'hi this is my first gist' to 'Hi This Is My First Gist'; | |
function changeAllToCaps(string){ | |
return (string.split(' ').map(function(x){ | |
x = x.charAt(0).toUpperCase() + x.slice(1); | |
return x ; | |
})).reduce(function(sum,value){ | |
return sum+' '+value; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment