Tell us what’s happening:
Hello;
Why this solution seems not working …?
**Your code so far**
function titleCase(str) {
var result = "";
for (let w of str.toLowerCase().split(' '))
result += " " + w.replace(w[0], w[0].toUpperCase());
return result;
}
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/99.0.4844.51 Safari/537.36
Challenge: Title Case a Sentence
Link to the challenge: