1const toCapitalCase = (string) => {
2 return string.charAt(0).toUpperCase() + string.slice(1);
3};
1const string = "tHIS STRING'S CAPITALISATION WILL BE FIXED."
2const string = string.charAt(0).toUpperCase() + string.slice(1)
1function toTitles(s){ return s.replace(/\w\S*/g, function(t) { return t.charAt(0).toUpperCase() + t.substr(1).toLowerCase(); }); }
2var str = toTitles('abraham lincoln'); // Abraham Lincoln