HELP -- Title Case a Sentence challenge -- HELP [CLOSED]

HELP -- Title Case a Sentence challenge -- HELP [CLOSED]
0

#1

Even though the code is working fine FCC is not accepting it. Can someone please help me with this.
Thanks.


#2

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.


#3
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");

#4

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 "


#5

Oh yeah ! Completely ignored it. Thank you so much. Fixed it, now it’s working. Thank you once again.