DEV Community 👩‍💻👨‍💻

Cover image for helloWorld to Hello World
Temitope Ayodele
Temitope Ayodele

Posted on

helloWorld to Hello World

To convert camelCase string to Title Case (ES6)

const convertCamelToTitleCase = (camelCase) =>
  camelCase
    .replace(/([A-Z])/g, (match) => ` ${match}`)
    .replace(/^./, (match) => match.toUpperCase())


//Example: convertCamelToTitleCase('todayILearned')
//Result: Today I Learned
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Head to your account's Settings to...

🌚 Enable dark mode
🔠 Change your default font
📚 Adjust your experience level to see more relevant content