In the string str I am making the string lower case and capitalizing the first word. Is there a better way to modify strings then what I did? I tried doing return str.toLowerCase().charAt(0).toUpperCase();, however, all this does is return the letter H. Is there a better way to chain methods onto a variable containing a string?
let str = `HOW ARE YOU DOING TODAY?`
function capitalize() {
str1 = str.toLowerCase()
return str.charAt(0).toUpperCase() + str1.slice(1);
}
console.log(capitalize()); /// -> How are you doing today?
str.charAt(0).toUpperCase() + str1.slice(1)in particular?text-transform: capitalize;?