First letter of each word in capital

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

This is the code I wrote for the uppercase challenge. I used a little more lines I think but this makes me understand better. I first wrote the code like below

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

What is the difference between these two, both run fine and give the same result. I think the difference is in the run time of the two. A little bit more light on this would be great. Thanks!

The first one has more operations chained together. One of the powerful features of JS.
But yes, the second one is a bit more readable.