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

Tell us what’s happening:

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:**

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

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.