Freecodecamp site has a bug or its just me?

why my code is wrong?

Basic Algorithm Scripting: Title Case a Sentence it doesn’t accept it?!

Return the provided string with the first letter of each word capitalized. Make sure the rest of the word is in lower case.

For the purpose of this exercise, you should also capitalize connecting words like “the” and “of”.

function titleCase(str) {
    let str2=str.split(' ');
    let capsStr="";
  for(let i=0;i<str2.length;i++){
    let correctWord = "";
    let letter="";
    for(let j =0 ; j<str2[i].length;j++){
       letter =  str2[i].charAt(0).toUpperCase();
        letter = str2[i].charAt(j).toLowerCase();
      correctWord +=letter;
    capsStr +=correctWord+" ";
  return capsStr;

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

You are almost done… So, so close!

You miss just one little spot. I wouldn’t want to spoil it for you. (Check the last character of the string you are returning :wink: )