all caps getting messed up in javascript code example
Example: javascript string proper case
function toTitleCase(str) {
return str.replace(
/\w\S*/g,
function(txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
}
);
}
// example
toTitleCase("the pains and gains of self study");
// "The Pains And Gains Of Self Study"