Title Case a Sentence- why my cod is not working?

Your code so far


function titleCase(str) {
  str=str.toLowerCase().split(' ');
  for (var i=0; i < str.length;i++){
    str[i].charAt(0).toUpperCase();
  }
  str = str.join(' ');
  return str;
}

titleCase("I'm a little tea pot");

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36.

Link to the challenge: