Even though the code is working fine FCC is not accepting it. Can someone please help me with this.
Thanks.
Post your code, not screenshot.
Also there is a button “ask for help on the forum” on the left side, which will do it for you automatically.
function titleCase(str) {
var temp = str.split(' ');
var strr = "";
for(var i=0; i< temp.length; i++)
{
strr = strr+temp[i][0].toUpperCase();
for(var j =1; j<temp[i].length; j++)
{
strr = strr+ temp[i][j].toLowerCase();
}
strr+=" ";
}
return strr;
}
titleCase("I'm a little tea pot");
You have a space at the end of the returned string.
Expected: "I’m A Little Tea Pot"
Returned: "I’m A Little Tea Pot "
Oh yeah ! Completely ignored it. Thank you so much. Fixed it, now it’s working. Thank you once again.