Please help withTitle Case a Sentence

Tell us what’s happening:
why is my algorithm not working ?

Your code so far


function titleCase(str) {
 var splited = str.split(" ");
 var changed = "";
 for(let i=0; i < splited.length; i++) {
   splited[i][0].toUpperCase();
    
 }
return splited;
}

var result = titleCase("I'm a little tea pot");
console.log(result);



Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/title-case-a-sentence

thank you. am still battling with how i can “build” version of word using my existing code concatenated…

my code is returning the correct output but for some reason it is not passing. This is my new code

function titleCase(str) {
 var splited = str.split(" ");
 var changed = "";
 for(let i=0; i < splited.length; i++) {
  changed += splited[i][0].toUpperCase() + splited[i].toLowerCase().substr(1) + " ";
  var strind = changed.toString();
    
 }
return strind;
}

var result = titleCase("HERE IS MY HANDLE HERE IS MY SPOUT");
console.log(result);



Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36.