I need help with the ["Title Case A Sentence"]

I need help with the “Title Case A Sentence” algorithm problem.

Here is my code below. The outputs are right but the tests are not passing. Any ideas?

function titleCase(str) {

      let newStr = str.split(' ');
      let capitalizeString = '';
      for(let i = 0; i < newStr.length; i++){
      let tempString = newStr[i].toLowerCase();
      capitalizeString += ' ' + tempString.charAt(0).toUpperCase() + tempString.slice(1);
      }
  return capitalizeString;
}

Do your spaces exactly match the required spaces?

Can you give me a test case where the whitespaces are off?

Every single one. How many spaces are originally at the start of the string?