Answers for "sentence case capitalisation js"

1

javascript title string

function toTitles(s){ return s.replace(/\w\S*/g, function(t) { return t.charAt(0).toUpperCase() + t.substr(1).toLowerCase(); }); }
var str = toTitles('abraham lincoln'); // Abraham Lincoln
Posted by: Guest on May-25-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language