(JS) Return a string with the first letter of each word capitalized, with the rest of the other word in lower case
Here the code:
function titleCase(str) {
let lowArray = str.toLowerCase().split(" ");
let outcome = lowArray.map(function(val){
return val.replace(val.charAt(0), val.charAt(0).toUpperCase());
});
return outcome.join(" ");
}
console.log(t...
cesaremannino.hashnode.dev4 min read