This is the code i have.
Everything works as expected.
Why does it not pass the test?
function titleCase(str) {
var wordArr = str.toLowerCase().split(' ')
var result = '';
wordArr.forEach(word => {
result += word.charAt(0).toUpperCase() + word.slice(1) + ' '
})
return result
}
titleCase("i'm a little tea pot"); // I'm A Little Tea Pot
**Your browser information:**
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:85.0) Gecko/20100101 Firefox/85.0.