Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

first letter of each word in a sentence to uppercase javascript

function capitalizeTheFirstLetterOfEachWord(words) {
   var separateWord = words.toLowerCase().split(' ');
   for (var i = 0; i < separateWord.length; i++) {
      separateWord[i] = separateWord[i].charAt(0).toUpperCase() +
      separateWord[i].substring(1);
   }
   return separateWord.join(' ');
}
console.log(capitalizeTheFirstLetterOfEachWord("my name is john"));
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #letter #word #sentence #uppercase #javascript
ADD COMMENT
Topic
Name
2+8 =