Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

title case javascript

function titleCase(str) {
    return str
        .split(' ')
        .map((word) => word[0].toUpperCase() + word.slice(1).toLowerCase())
        .join(' ');
}
console.log(titleCase("I'm a little tea pot")); // I'm A Little tea Pot
 
PREVIOUS NEXT
Tagged: #title #case #javascript
ADD COMMENT
Topic
Name
2+8 =