Three Ways to Title Case a Sentence in JavaScript
Sonya Moisset

Hi Sonya I was wondering if i can to change de code like this. Could works:

I’m using RegExp:

function titleCase(str) {
 return str.toLowerCase().replace(/\b\w/g,function myfun(x){return x.toUpperCase();}); 

titleCase(“I’m a little tea pot”);

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.