Answers for "javascript camel case to title case"

6

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
Posted by: Guest on November-05-2020
0

camelcase to normal text javascript

"thisStringIsGood"
    // insert a space before all caps
    .replace(/([A-Z])/g, ' $1')
    // uppercase the first character
    .replace(/^./, function(str){ return str.toUpperCase(); })
Posted by: Guest on May-20-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language