function titleCase(str) {
var word = str.split(' ');
var max='';
var line ='';
for(let i=0; i<word.length; i++){
max= word[i].charAt(0).toUpperCase() + word[i].slice(1).toLowerCase();
line = line.concat(' ', max);
}
// console.log(line)
return line;
}
titleCase("I'm a little tea pot");
this is my code of Title case challenge. I tried running in my compiler and used console.log to try in window and it was running totally fine, but still not able to pass test cases.https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-algorithm-scripting/title-case-a-sentence