Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript uppercase first letter of each word

const toTitleCase = (phrase) => {
  return phrase
    .toLowerCase()
    .split(' ')
    .map(word => word.charAt(0).toUpperCase() + word.slice(1))
    .join(' ');
};

let result = toTitleCase('maRy hAd a lIttLe LaMb');
console.log(result);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #uppercase #letter #word
ADD COMMENT
Topic
Name
1+5 =