JSFiddle - React, Tailwind, and code Playground
JavaScript
function zzz() {
var cp_value= ucwords("erğm lış-çr-turk",true);
alert(cp_value)
};
function ucwords(str,force){
str=force ? str.toLowerCase() : str;
var temp= str.split(" ");
for(var i=0; i<temp.length; i++) {
temp[i] = temp[i].substr(0,1).toUpperCase() + temp[i].substr(1,temp[i].length-1)
}
return temp.join(' ');
}
zzz();