Tell us what’s happening:
Describe your issue in detail here.
so i was coding this and it returns a string with each first letter capitalized but it still gives error any help that i can get??
**Your code so far**
function titleCase(str) {
str=str.toLowerCase().split(" ");
let newStr="";
for(let i=0;i<str.length;i++){
newStr = newStr + " "+ str[i].charAt(0).toUpperCase()+str[i].slice(1);
}
return newStr;
}
titleCase("sHoRt AnD sToUt");
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36
Challenge: Title Case a Sentence
Link to the challenge: