JSFiddle - React, Tailwind, and code Playground
InitCap / Proper Case / Came Case a Sentence in JavaScript ,,, forked from http://jsfiddle.net/rf3GJ/16/
by dledle2
HTML
<div id="123">aaa</div>
JavaScript
str = "hEllo woRld";
zzzString.prototype.initCap = function () {
return this.toLowerCase().replace(/(?:^|\s)[a-z]/g, function (m) {
return m.toUpperCase();
});
};
console.log(str.initCap());