Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function LetterCapitalize(str) { // str = "this is test"
- return str.split(' ') // ["this", "is", "test"]
- .map(function(word){
- return word[0].toUpperCase() + word.substring(1); // ["This", "Is", "Test"]
- })
- .join(' '); // "This Is Test"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement