Tell us what’s happening:
It looks perfect to me and console test works but FCC is not letting me pass the test.
Your code so far
function titleCase(str) {
let strArr=str.split(" ");
let Str="";
for (let i=0; i<strArr.length; i++){
let strWord = strArr[i]
let word = strWord.charAt(0).toUpperCase();
for (let j=1; j<strWord.length; j++){
let otherWords = strWord.charAt(j).toLowerCase();
word= word+otherWords;
}
Str=Str+" "+word;
}
return Str;
}
console.log(titleCase("sHoRt AnD sToUt"));
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36.
Challenge: Title Case a Sentence
Link to the challenge: