Help with a little tea pot

Tell us what’s happening:

The answers are coming out correct but it is showing 4"I’m A Little Tea Pot" in console before the short and stout i do not know why it is incorrect. any help would be appreciated

Your code so far

function titleCase(str) {
let answer = "";
let arr = str.split(" ");
for(let i = 0; i < arr.length; i++){
  answer += arr[i].charAt(0).toUpperCase() + arr[i].slice(1).toLowerCase() + " ";

return answer;


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/79.0.3945.88 Safari/537.36.

Challenge: Title Case a Sentence

Link to the challenge:


I’ve enclosed your returned string in <>, so you can see what might be just slightly off from the test.

thank you for your help