What's wrong with my code? ayuda

Tell us what’s happening:
Return the same but but still said error.

Your code so far

function titleCase(str) {
  var some = str.split(' ');
  /*var all =some[1].charAt(0);
  all = all.toUpperCase();
  */
  var all=[];
  var aqui='';
  
  for(var i= 0; i < some.length; i++){
    
    some[i] = some[i].toLowerCase();
     all = some[i].replace(some[i][0],some[i][0].toUpperCase());
     
     aqui += all + " ";
  }
  return aqui ;
}
 

titleCase("I'm a little tea pot");
**Your browser information:**

Your Browser User Agent is: ```Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:48.0) Gecko/20100101 Firefox/48.0```.

**Link to the challenge:**
https://www.freecodecamp.org/challenges/title-case-a-sentence

your returning strings all have an extra space at the end, making them fail the test:

expected: 'I'm A Little Tea Pot'
received: 'I'm A Little Tea Pot '

The reason is this line in your code

That add the space regardless of the string position :slight_smile:

Hope it helps

Thanks for the reply ,i will see :slight_smile:

Thanks for your comment, i resolved the problem with this “return aqui.trim();”