Tell us what’s happening:
Your code so far
function titleCase(str) {
str = str.split(' ');
for (i = 0; i < str.length; i++) {
str[i] = str[i].split('');
}
for(i=0;i<str.length;i++)
{
str[i][0] = str[i][0].toUpperCase();
}
for (i = 1; i < str.length; i++) {
str[i] = str[i].toLowerCase();
str[i] = str[i].join('');
}
return str.join(' ');
}
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/63.0.3239.132 Safari/537.36 OPR/50.0.2762.58
.
Link to the challenge:
https://www.freecodecamp.org/challenges/title-case-a-sentence