Title Case a Sentence with replace

Title Case a Sentence with replace
0.0 0

#1

See it works cool

Your code so far

var b;
var c=[];
function titleCase(str) {
  
  a=str.toLowerCase().split(" ");
  
  for(i=0;i<a.length;i++){
  
  b=a[i].replace(a[i][0],a=>a.toUpperCase());
  
  c.push(b);
  
  }
  return c.join(" ");
}

titleCase("sHoRt AnD sToUt");

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36.

Link to the challenge: