Title Case a Sentence - solved

I’ve tried a bunch of methods on this challenge and this is the furthest I’ve made it, but I can’t seem to join the array elements together into a string. Am I missing something blindingly obvious?

Your code so far


function titleCase(str) {
  let words = str.toLowerCase().split(" ");
  let title = [];
  for (let i = 0; i < words.length; i++) {
    for (let j = 0; j < words[i].length; j++) {
      if (j === 0) {
        title.push(words[i][j].toUpperCase());
      } else {
        title.push(words[i][j]);
      }
    }
    title.push(" ");
  }
  title.join();
  return title;
}

console.log(titleCase("I'm a little tea pot"));

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 10718.88.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.118 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/title-case-a-sentence

Ooh, I can’t delete the topic, but it’s sorted.

For anyone searching (if this stays online), I condensed

title.join();
return title;

into

return title.join("");

and it sewed it up quite nicely.