Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Return the provided string with the first letter of each word capitalized

const mySentence = "freeCodeCamp is an awesome resource";
const words = mySentence.split(" ");

for (let i = 0; i < words.length; i++) {
    words[i] = words[i][0].toUpperCase() + words[i].substr(1);
}

words.join(" ");
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Return #string #letter #word #capitalized
ADD COMMENT
Topic
Name
5+4 =