Basic Algorithm Scripting - Title Case a Sentence

Tell us what’s happening:
Describe your issue in detail here.
I tested it by console.log() to verify it’s output, and all three cases are works, but it still won’t pass, I don’t why.
Your code so far

function titleCase(str) { 
  const strArr=str.split(" ");
  let newStr="";
  for(let i=0 ; i<strArr.length;i++)
  {
    newStr+=strArr[i][0].toUpperCase()+strArr[i].slice(1,strArr[i].length).toLowerCase()+" ";
  } 
 
  return newStr;
}
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/105.0.0.0 Safari/537.36

Challenge: Basic Algorithm Scripting - Title Case a Sentence

Link to the challenge:

Hello!

Check the output and make sure there are no spaces at the end/start of the string.

Hint: print (console.log) your strings surrounded by quotes