Tell us what’s happening:
Why does it not work??
Your code so far
function titleCase(str) {
let sentence = str.toLowerCase().split(" ");
for (let i = 0; i < sentence.length; i++){
sentence[i][0] = sentence[i][0].toUpperCase();
}
return sentence.join(" ");
}
titleCase("I'm a little tea pot");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36
.
Challenge: Title Case a Sentence
Link to the challenge: