Why CodeCamp's system doesnt want to accept my task?

Why CodeCamp's system doesnt want to accept my task?
0

#1

Tell us what’s happening:

Hello!
I dont understand why the FreeCodeCamp’s system doesnt want to accept my task? I think the code works and fullfills the requirements. Maybe im wrong?

function titleCase(str) {
              var arr = str.split(" ");
              for (var i = 0; i < arr.length; i++){
                  arr[i] = arr[i].split("");
                  for (var x = 0; x < 1; x++){
                   arr[i][x] = arr[i][x].toUpperCase();
                  }
                  for (var y = 1; y <arr[i].length; y++){
                   arr[i][y] = arr[i][y].toLowerCase();
                  }
                  arr[i] = arr[i].join("");
              }
            str = arr.join("  ");
            return str;
        }

```


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

#2

Done!
I havent seen additional free space in last but one line;


#3

You don’t have spaces on the ends, but now you have spaces between each word.

str = arr.join("  ");

The above joins arr with two spaces instead of one, so delete one of the spaces and you should be fine.